@Test public void testToAny() { Collector<Boolean, RefBoolean, Boolean> collector = CollectorsEx.toAny(); Boolean collect = Stream.of(true, true).collect(collector); assertTrue(collect); collect = Stream.of(true, false).collect(collector); assertTrue(collect); collect = Stream.of(false, true).collect(collector); assertTrue(collect); collect = Stream.of(false, false).collect(collector); assertFalse(collect); }
public static <T> Collector<T, RefBoolean, Boolean> toAny(Predicate<T> predicate) { return Collector.of( () -> new RefBoolean(false), (a, t) -> a.value |= predicate.test(t), (a1, a2) -> { a1.value |= a2.value; return a1; }, b -> b.value); }
CollectorsEx { public static <T> Collector<T, RefBoolean, Boolean> toAny(Predicate<T> predicate) { return Collector.of( () -> new RefBoolean(false), (a, t) -> a.value |= predicate.test(t), (a1, a2) -> { a1.value |= a2.value; return a1; }, b -> b.value); } }
CollectorsEx { public static <T> Collector<T, RefBoolean, Boolean> toAny(Predicate<T> predicate) { return Collector.of( () -> new RefBoolean(false), (a, t) -> a.value |= predicate.test(t), (a1, a2) -> { a1.value |= a2.value; return a1; }, b -> b.value); }  }
CollectorsEx { public static <T> Collector<T, RefBoolean, Boolean> toAny(Predicate<T> predicate) { return Collector.of( () -> new RefBoolean(false), (a, t) -> a.value |= predicate.test(t), (a1, a2) -> { a1.value |= a2.value; return a1; }, b -> b.value); }  @SuppressWarnings("unchecked") static Collector<T, Void, Void> toVoid(); static Collector<T, Ref<T>, T> toFirst(); static Collector<T, Ref<T>, T> toLast(); static Collector<T, RefBoolean, Boolean> toAll(Predicate<? super T> predicate); static Collector<Boolean, RefBoolean, Boolean> toAll(); static Collector<T, RefBoolean, Boolean> toAny(Predicate<T> predicate); static Collector<Boolean, RefBoolean, Boolean> toAny(); static Collector<T, RefBoolean, Boolean> toNone(Predicate<T> predicate); static Collector<Boolean, RefBoolean, Boolean> toNone(); static BinaryOperator<T> throwingMerger(); static Collector<Entry<K, V>, ?, Map<K, V>> toMap(); static Collector<T, ?, Map<K, Set<V>>> toMultimap(Function<? super T, ? extends K> keyMapper,
			Function<? super T, ? extends V> valueMapper); }
CollectorsEx { public static <T> Collector<T, RefBoolean, Boolean> toAny(Predicate<T> predicate) { return Collector.of( () -> new RefBoolean(false), (a, t) -> a.value |= predicate.test(t), (a1, a2) -> { a1.value |= a2.value; return a1; }, b -> b.value); }  @SuppressWarnings("unchecked") static Collector<T, Void, Void> toVoid(); static Collector<T, Ref<T>, T> toFirst(); static Collector<T, Ref<T>, T> toLast(); static Collector<T, RefBoolean, Boolean> toAll(Predicate<? super T> predicate); static Collector<Boolean, RefBoolean, Boolean> toAll(); static Collector<T, RefBoolean, Boolean> toAny(Predicate<T> predicate); static Collector<Boolean, RefBoolean, Boolean> toAny(); static Collector<T, RefBoolean, Boolean> toNone(Predicate<T> predicate); static Collector<Boolean, RefBoolean, Boolean> toNone(); static BinaryOperator<T> throwingMerger(); static Collector<Entry<K, V>, ?, Map<K, V>> toMap(); static Collector<T, ?, Map<K, Set<V>>> toMultimap(Function<? super T, ? extends K> keyMapper,
			Function<? super T, ? extends V> valueMapper); static final Collector<Object, Void, Void> TO_VOID; }