@Override public void forEach(Consumer<? super E> action) { iterable.forEach(action); }
@Override public void forEach(Consumer<? super T> action) { iterable.forEach(action); }
@Override public void forEach(Consumer<? super T> action) { iterable.forEach(action); }
@Override public void forEach(Consumer<? super T> action) { checkNotNull(action); fromIterable.forEach((F f) -> action.accept(function.apply(f))); }
@Override public void forEach(Consumer<? super T> action) { checkNotNull(action); unfiltered.forEach( (T a) -> { if (retainIfTrue.test(a)) { action.accept(a); } }); }
public DruidServer addDataSegments(DruidServer server) { server.getSegments().forEach(this::addDataSegment); return this; }
public static void validateHeader(CharSequence name, Iterable<? extends CharSequence> values) { validateHeaderName(name); values.forEach(HEADER_VALUE_VALIDATOR); }
private Map<AdminCommandSection,List<AdminCommand.Provider>> groupProvidersBySection() { List<AdminCommand.Provider> providers = new ArrayList<>(); commands.getAllProviders().forEach( providers::add ); return providers.stream().collect( Collectors.groupingBy( AdminCommand.Provider::commandSection ) ); } }
@Override public void forEach(Consumer<? super T> action) { checkNotNull(action); unfiltered.forEach( (T a) -> { if (retainIfTrue.test(a)) { action.accept(a); } }); }
@Override public void forEach(Consumer<? super T> action) { checkNotNull(action); fromIterable.forEach((F f) -> action.accept(function.apply(f))); }
static String iterationOrder(Iterable<? extends Node> iterable) { StringBuilder builder = new StringBuilder(); for (Node t : iterable) { builder.append(t.value); } StringBuilder forEachBuilder = new StringBuilder(); iterable.forEach(t -> forEachBuilder.append(t.value)); assertTrue( "Iterator content was " + builder + " but forEach content was " + forEachBuilder, builder.toString().contentEquals(forEachBuilder)); return builder.toString(); }
private static int count(Iterable<Node> nodes) { assertNotNull(nodes); AtomicInteger count = new AtomicInteger(); nodes.forEach(n -> count.incrementAndGet()); return count.get(); }
public void testTransform_forEach() { List<Integer> input = asList(1, 2, 3, 4); Iterable<String> result = Iterables.transform( input, new Function<Integer, String>() { @Override public String apply(Integer from) { return Integer.toBinaryString(from); } }); Iterator<String> expectedIterator = asList("1", "10", "11", "100").iterator(); result.forEach(s -> assertEquals(expectedIterator.next(), s)); assertFalse(expectedIterator.hasNext()); }
public void testUnmodifiableIterable_forEach() { List<String> list = newArrayList("a", "b", "c", "d"); Iterable<String> iterable = Iterables.unmodifiableIterable(list); Iterator<String> expectedIterator = list.iterator(); iterable.forEach(s -> assertEquals(expectedIterator.next(), s)); assertFalse(expectedIterator.hasNext()); }
private static void writeBufferedBodyContent(final HttpRequestMessage zuulRequest, final Channel channel) { zuulRequest.getBodyContents().forEach((chunk) -> { channel.write(chunk.retain()); }); }
public void processGroupImports() { for (DeferredImportSelectorGrouping grouping : this.groupings.values()) { grouping.getImports().forEach(entry -> { ConfigurationClass configurationClass = this.configurationClasses.get( entry.getMetadata()); try { processImports(configurationClass, asSourceClass(configurationClass), asSourceClasses(entry.getImportClassName()), false); } catch (BeanDefinitionStoreException ex) { throw ex; } catch (Throwable ex) { throw new BeanDefinitionStoreException( "Failed to process import candidates for configuration class [" + configurationClass.getMetadata().getClassName() + "]", ex); } }); } }
@GwtIncompatible // Iterables.filter(Iterable, Class) public void testFilterByType_forEach() throws Exception { HasBoth hasBoth1 = new HasBoth(); HasBoth hasBoth2 = new HasBoth(); Iterable<TypeA> alist = Lists.newArrayList(hasBoth1, new TypeA(), hasBoth2, new TypeA()); Iterable<TypeB> blist = Iterables.filter(alist, TypeB.class); Iterator<TypeB> expectedIterator = Arrays.<TypeB>asList(hasBoth1, hasBoth2).iterator(); blist.forEach(b -> assertThat(b).isEqualTo(expectedIterator.next())); assertThat(expectedIterator.hasNext()).isFalse(); }
public void testForEach() { for (List<Integer> contents : SAMPLE_INPUTS) { C unfiltered = createUnfiltered(contents); C filtered = filter(unfiltered, EVEN); List<Integer> foundElements = new ArrayList<>(); filtered.forEach( (Integer i) -> { assertTrue("Unexpected element: " + i, EVEN.apply(i)); foundElements.add(i); }); assertEquals(ImmutableList.copyOf(filtered), foundElements); } } }
@Test public void testPropertiesWithRestrictedConfigs() { Injector injector = Guice.createInjector(Collections.singletonList(new PropertiesModule(Collections.singletonList( "status.resource.test.runtime.properties")))); Map<String, String> returnedProperties = injector.getInstance(StatusResource.class).getProperties(); Set<String> hiddenProperties = new HashSet<>(); Splitter.on(",").split(returnedProperties.get("druid.server.hiddenProperties")).forEach(hiddenProperties::add); hiddenProperties.forEach((property) -> Assert.assertNull(returnedProperties.get(property))); } }
private static void writeBufferedBodyContent(final HttpRequestMessage zuulRequest, final Channel channel) { zuulRequest.getBodyContents().forEach((chunk) -> { channel.write(chunk.retain()); }); }