public static List<NameValuePair> parseQueryOrdered(String query) throws URISyntaxException {
  List<NameValuePair> parameters=new ArrayList<NameValuePair>();
  if (query == null) {
    return parameters;
  }
  URIQueryTokenizer uqt=new URIQueryTokenizer(query);
  while (uqt.hasMoreTokens()) {
    String token=uqt.nextToken();
    int index=token.indexOf(URI.PARAMETER_SEPARATOR);
    String name;
    String value;
    if (index != -1) {
      name=token.substring(0,index);
      value=token.substring(index + 1);
    }
 else {
      name=token;
      value=null;
    }
    parameters.add(new NameValuePair(name,value));
  }
  return parameters;
}

public static List < NameValuePair > parseQueryOrdered ( String query ) throws URISyntaxException { List < NameValuePair > parameters = new ArrayList < NameValuePair > ( ) ; if ( query == null ) { return parameters ; } URIQueryTokenizer uqt = new URIQueryTokenizer ( query ) ; while ( uqt . hasMoreTokens ( ) ) { String token = uqt . nextToken ( ) ; int index = token . indexOf ( URI . PARAMETER_SEPARATOR ) ; String name ; String value ; if ( index != - 1 ) { name = token . substring ( 0 , index ) ; value = token . substring ( index + 1 ) ; } else { name = token ; value = null ; } parameters . add ( new NameValuePair ( name , value ) ) ; } return parameters ; }
parse a uri query string , returning a list of name / value pairs in the order they occur in the query and keeping duplicates .
