private static Map<String,Set<String>> parseSparseFields(MultivaluedMap<String,String> queryParams){
  Map<String,Set<String>> result=new HashMap<>();
  for (  Map.Entry<String,List<String>> kv : queryParams.entrySet()) {
    String key=kv.getKey();
    if (key.startsWith("fields[") && key.endsWith("]")) {
      String type=key.substring(7,key.length() - 1);
      LinkedHashSet<String> filters=new LinkedHashSet<>();
      for (      String filterParams : kv.getValue()) {
        Collections.addAll(filters,filterParams.split(","));
      }
      if (!filters.isEmpty()) {
        result.put(type,filters);
      }
    }
  }
  return result;
}

private static Map < String , Set < String > > parseSparseFields ( MultivaluedMap < String , String > queryParams ) { Map < String , Set < String > > result = new HashMap < > ( ) ; for ( Map . Entry < String , List < String > > kv : queryParams . entrySet ( ) ) { String key = kv . getKey ( ) ; if ( key . startsWith ( "fields[" ) && key . endsWith ( "]" ) ) { String type = key . substring ( 7 , key . length ( ) - 1 ) ; LinkedHashSet < String > filters = new LinkedHashSet < > ( ) ; for ( String filterParams : kv . getValue ( ) ) { Collections . addAll ( filters , filterParams . split ( "," ) ) ; } if ( ! filters . isEmpty ( ) ) { result . put ( type , filters ) ; } } } return result ; }
parses queryparams and produces sparsefields map .
