@Test public void testIterator() { params.put("foo", newList("bar", "baz")); params.put("abc", newList("def", "123")); final HttpQuery query = new HttpQuery(params, queryParamsUpdater); final Iterator<Map.Entry<String, String>> iterator = query.iterator(); assertTrue(iterator.hasNext()); Map.Entry<String, String> entry = iterator.next(); assertEquals("foo", entry.getKey()); assertEquals("bar", entry.getValue()); assertTrue(iterator.hasNext()); entry = iterator.next(); assertEquals("foo", entry.getKey()); assertEquals("baz", entry.getValue()); assertTrue(iterator.hasNext()); entry = iterator.next(); assertEquals("abc", entry.getKey()); assertEquals("def", entry.getValue()); assertTrue(iterator.hasNext()); entry = iterator.next(); assertEquals("abc", entry.getKey()); assertEquals("123", entry.getValue()); assertFalse(iterator.hasNext()); expected.expect(NoSuchElementException.class); iterator.next(); }
@Override public Iterator<Entry<String, String>> iterator() { return new QueryIterator(params.entrySet().iterator(), this::updateQueryParams); }
HttpQuery implements Iterable<Map.Entry<String, String>> { @Override public Iterator<Entry<String, String>> iterator() { return new QueryIterator(params.entrySet().iterator(), this::updateQueryParams); } }
HttpQuery implements Iterable<Map.Entry<String, String>> { @Override public Iterator<Entry<String, String>> iterator() { return new QueryIterator(params.entrySet().iterator(), this::updateQueryParams); } HttpQuery(final Map<String, List<String>> params, final Consumer<Map<String, List<String>>> queryParamsUpdater); }
HttpQuery implements Iterable<Map.Entry<String, String>> { @Override public Iterator<Entry<String, String>> iterator() { return new QueryIterator(params.entrySet().iterator(), this::updateQueryParams); } HttpQuery(final Map<String, List<String>> params, final Consumer<Map<String, List<String>>> queryParamsUpdater); @Nullable String get(final String key); Iterator<String> valuesIterator(final String key); Iterable<String> values(final String key); Set<String> keys(); HttpQuery add(final String key, final String value); HttpQuery add(final String key, final Iterable<String> values); HttpQuery add(final String key, final String... values); HttpQuery set(final String key, final String value); HttpQuery set(final String key, final Iterable<String> values); HttpQuery set(final String key, final String... values); boolean contains(final String key, final String value); boolean remove(final String key); boolean remove(final String key, final String value); int size(); @Override Iterator<Entry<String, String>> iterator(); }
HttpQuery implements Iterable<Map.Entry<String, String>> { @Override public Iterator<Entry<String, String>> iterator() { return new QueryIterator(params.entrySet().iterator(), this::updateQueryParams); } HttpQuery(final Map<String, List<String>> params, final Consumer<Map<String, List<String>>> queryParamsUpdater); @Nullable String get(final String key); Iterator<String> valuesIterator(final String key); Iterable<String> values(final String key); Set<String> keys(); HttpQuery add(final String key, final String value); HttpQuery add(final String key, final Iterable<String> values); HttpQuery add(final String key, final String... values); HttpQuery set(final String key, final String value); HttpQuery set(final String key, final Iterable<String> values); HttpQuery set(final String key, final String... values); boolean contains(final String key, final String value); boolean remove(final String key); boolean remove(final String key, final String value); int size(); @Override Iterator<Entry<String, String>> iterator();  }