@Test public void fromUrlEncodedShouldParseQueryStringAndReturnEncodedParams(){ List<EncodedPair> actual = Pairs.fromUrlEncoded("p1=v%201&p1=v%202&p2=v%203"); assertNotNull(actual); assertEquals(3, actual.size()); assertEquals("p1", actual.get(0).getName()); assertEquals("v%201", actual.get(0).getValue()); assertEquals("p1", actual.get(1).getName()); assertEquals("v%202", actual.get(1).getValue()); assertEquals("p2", actual.get(2).getName()); assertEquals("v%203", actual.get(2).getValue()); }
public static List<EncodedPair> fromUrlEncoded(String urlEncoded) { List<EncodedPair> pairs = new ArrayList<EncodedPair>(); String[] split = AMP.split(urlEncoded); for(String param : split){ String[] paramSplit = EQUAL.split(param); pairs.add(toPreEncodedPair(paramSplit[0], paramSplit[1])); } return pairs; }
Pairs { public static List<EncodedPair> fromUrlEncoded(String urlEncoded) { List<EncodedPair> pairs = new ArrayList<EncodedPair>(); String[] split = AMP.split(urlEncoded); for(String param : split){ String[] paramSplit = EQUAL.split(param); pairs.add(toPreEncodedPair(paramSplit[0], paramSplit[1])); } return pairs; } }
Pairs { public static List<EncodedPair> fromUrlEncoded(String urlEncoded) { List<EncodedPair> pairs = new ArrayList<EncodedPair>(); String[] split = AMP.split(urlEncoded); for(String param : split){ String[] paramSplit = EQUAL.split(param); pairs.add(toPreEncodedPair(paramSplit[0], paramSplit[1])); } return pairs; } private  Pairs(); }
Pairs { public static List<EncodedPair> fromUrlEncoded(String urlEncoded) { List<EncodedPair> pairs = new ArrayList<EncodedPair>(); String[] split = AMP.split(urlEncoded); for(String param : split){ String[] paramSplit = EQUAL.split(param); pairs.add(toPreEncodedPair(paramSplit[0], paramSplit[1])); } return pairs; } private  Pairs(); static EncodedPair toPreEncodedPair(String name, String value); static EncodedPair toPair(String nameToEncode, String valueToEncode, Charset charset); static EncodedPair toPair(String name, String value, Charset charset, boolean encoded); static List<EncodedPair> fromUrlEncoded(String urlEncoded); static List<EncodedPair> sortByNameAndValues(List<? extends EncodedPair> pairs); static String join(List<? extends EncodedPair> pairs, char pairSep); static String join(List<? extends EncodedPair> pairs, char pairSep, char nameValSep); static String join(List<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal); static String join(Iterator<? extends EncodedPair> pairs, char pairSep); static String join(Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep); static String join(Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal); static void join(Writer writer, List<? extends EncodedPair> pairs, char pairSep); static void join(Writer writer, List<? extends EncodedPair> pairs, char pairSep, char nameValSep); static void join(Writer writer, List<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal); static void join(Writer writer, Iterator<? extends EncodedPair> pairs, char pairSep); static void join(Writer writer, Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep); static void join(Writer writer, Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal); }
Pairs { public static List<EncodedPair> fromUrlEncoded(String urlEncoded) { List<EncodedPair> pairs = new ArrayList<EncodedPair>(); String[] split = AMP.split(urlEncoded); for(String param : split){ String[] paramSplit = EQUAL.split(param); pairs.add(toPreEncodedPair(paramSplit[0], paramSplit[1])); } return pairs; } private  Pairs(); static EncodedPair toPreEncodedPair(String name, String value); static EncodedPair toPair(String nameToEncode, String valueToEncode, Charset charset); static EncodedPair toPair(String name, String value, Charset charset, boolean encoded); static List<EncodedPair> fromUrlEncoded(String urlEncoded); static List<EncodedPair> sortByNameAndValues(List<? extends EncodedPair> pairs); static String join(List<? extends EncodedPair> pairs, char pairSep); static String join(List<? extends EncodedPair> pairs, char pairSep, char nameValSep); static String join(List<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal); static String join(Iterator<? extends EncodedPair> pairs, char pairSep); static String join(Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep); static String join(Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal); static void join(Writer writer, List<? extends EncodedPair> pairs, char pairSep); static void join(Writer writer, List<? extends EncodedPair> pairs, char pairSep, char nameValSep); static void join(Writer writer, List<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal); static void join(Writer writer, Iterator<? extends EncodedPair> pairs, char pairSep); static void join(Writer writer, Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep); static void join(Writer writer, Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal);  }