static Map < String , Set < String > > groupNameToSet ( GravityNameValue [ ] nameValues ) { Map < String , Set < String > > result = new HashMap <> ( ) ; for ( GravityNameValue nameValue : nameValues ) { if ( nameValue . name == null || nameValue . value == null ) continue ; if ( ! result . containsKey ( nameValue . name ) ) result . put ( nameValue . name , new LinkedHashSet < String > ( ) ) ; Collections . addAll ( result . get ( nameValue . name ) , nameValue . value ) ; } return result ; }
Transform grouped into a map of name to a linked set of values