@Test public void parseQuery_paramWithNoAssignment() { URI uri = URI.create("https: Multimap<?, ?> query = HttpRequests.parseQuery(uri); assertNotNull(query); ImmutableMultimap.copyOf(query); }
@Nullable public static Multimap<String, Optional<String>> parseQuery(URI uri) { if (uri.getQuery() == null) { return null; } List<Entry<String, String>> nvps = URLEncodedUtils.parse(uri, StandardCharsets.UTF_8); Multimap<String, Optional<String>> mm = ArrayListMultimap.create(); nvps.forEach(nvp -> { mm.put(nvp.getKey().toLowerCase(), Optional.ofNullable(nvp.getValue())); }); return mm; }
HttpRequests { @Nullable public static Multimap<String, Optional<String>> parseQuery(URI uri) { if (uri.getQuery() == null) { return null; } List<Entry<String, String>> nvps = URLEncodedUtils.parse(uri, StandardCharsets.UTF_8); Multimap<String, Optional<String>> mm = ArrayListMultimap.create(); nvps.forEach(nvp -> { mm.put(nvp.getKey().toLowerCase(), Optional.ofNullable(nvp.getValue())); }); return mm; } }
HttpRequests { @Nullable public static Multimap<String, Optional<String>> parseQuery(URI uri) { if (uri.getQuery() == null) { return null; } List<Entry<String, String>> nvps = URLEncodedUtils.parse(uri, StandardCharsets.UTF_8); Multimap<String, Optional<String>> mm = ArrayListMultimap.create(); nvps.forEach(nvp -> { mm.put(nvp.getKey().toLowerCase(), Optional.ofNullable(nvp.getValue())); }); return mm; } private  HttpRequests(); }
HttpRequests { @Nullable public static Multimap<String, Optional<String>> parseQuery(URI uri) { if (uri.getQuery() == null) { return null; } List<Entry<String, String>> nvps = URLEncodedUtils.parse(uri, StandardCharsets.UTF_8); Multimap<String, Optional<String>> mm = ArrayListMultimap.create(); nvps.forEach(nvp -> { mm.put(nvp.getKey().toLowerCase(), Optional.ofNullable(nvp.getValue())); }); return mm; } private  HttpRequests(); static Multimap<String, V> indexHeaders(Stream<? extends Map.Entry<String, V>> entryHeaders); @Nullable static Multimap<String, Optional<String>> parseQuery(URI uri); }
HttpRequests { @Nullable public static Multimap<String, Optional<String>> parseQuery(URI uri) { if (uri.getQuery() == null) { return null; } List<Entry<String, String>> nvps = URLEncodedUtils.parse(uri, StandardCharsets.UTF_8); Multimap<String, Optional<String>> mm = ArrayListMultimap.create(); nvps.forEach(nvp -> { mm.put(nvp.getKey().toLowerCase(), Optional.ofNullable(nvp.getValue())); }); return mm; } private  HttpRequests(); static Multimap<String, V> indexHeaders(Stream<? extends Map.Entry<String, V>> entryHeaders); @Nullable static Multimap<String, Optional<String>> parseQuery(URI uri);  }