@ SuppressWarnings ( "PMD.AvoidInstantiatingObjectsInLoops" ) private static SortedMap < String , List < String > > asMap ( final String query ) { final SortedMap < String , List < String > > params = new TreeMap <> ( ) ; if ( query != null ) { for ( final String pair : query . split ( "&" ) ) { final String [ ] parts = pair . split ( "=" , 2 ) ; final String key = Href . decode ( parts [ 0 ] ) ; final String value ; if ( parts . length > 1 ) { value = Href . decode ( parts [ 1 ] ) ; } else { value = "" ; } if ( ! params . containsKey ( key ) ) { params . put ( key , new LinkedList <> ( ) ) ; } params . get ( key ) . add ( value ) ; } } return params ; }
Convert the provided query into a Map .