final class TypesImpFilter
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <C extends java.util.Collection<? super T>,T> |
filterImpl(C target,
java.util.Enumeration<T> enumeration,
java.util.function.Predicate<? super T> checker)
Filter the elements of an iterator into a collection.
|
static <C extends java.util.Collection<? super T>,T> |
filterImpl(C target,
java.util.Iterator<T> iterator,
java.util.function.Predicate<? super T> checker)
Filter the elements of an iterator into a collection.
|
@NotNull public static <C extends java.util.Collection<? super T>,T> C filterImpl(@NotNull C target, @NotNull java.util.Iterator<T> iterator, @NotNull java.util.function.Predicate<? super T> checker)
This will add all filtered elements to the target collection.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- filtered typetarget
- collection where the mapped elements are addediterator
- iterator providing the source elementschecker
- value checker to decide which elements are kept@NotNull public static <C extends java.util.Collection<? super T>,T> C filterImpl(@NotNull C target, @NotNull java.util.Enumeration<T> enumeration, @NotNull java.util.function.Predicate<? super T> checker)
This will add all filtered elements to the target collection.
Note that iterator is not allowed to be an iterator of the target collection, otherwise you'll
get either a ConcurrentModificationException
, or another exception
because you are running into an endless loop.
C
- collection typeT
- filtered typetarget
- collection where the mapped elements are addedenumeration
- enumeration providing the source elementschecker
- value checker to decide which elements are kept