Class IteratorIterate
java.lang.Object
org.eclipse.collections.impl.utility.internal.IteratorIterate
The IteratorIterate class implementations of the various iteration patterns for use with java.util.Iterator.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Iterator<T>
advanceIteratorTo
(Iterator<T> iterator, int from) static <T,
K, V> MutableMap<K, V> aggregateBy
(Iterator<T> iterator, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator) static <T,
K, V> MutableMap<K, V> aggregateBy
(Iterator<T> iterator, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator) static <T> boolean
allSatisfy
(Iterator<T> iterator, Predicate<? super T> predicate) static <T,
P> boolean allSatisfyWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) static <T> boolean
anySatisfy
(Iterator<T> iterator, Predicate<? super T> predicate) static <T,
P> boolean anySatisfyWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) static <T> RichIterable<RichIterable<T>>
static <T,
V, R extends Collection<V>>
Rstatic <T> MutableBooleanCollection
collectBoolean
(Iterator<T> iterator, BooleanFunction<? super T> booleanFunction) static <T,
R extends MutableBooleanCollection>
RcollectBoolean
(Iterator<T> iterator, BooleanFunction<? super T> booleanFunction, R target) static <T> MutableByteCollection
collectByte
(Iterator<T> iterator, ByteFunction<? super T> byteFunction) static <T,
R extends MutableByteCollection>
RcollectByte
(Iterator<T> iterator, ByteFunction<? super T> byteFunction, R target) static <T> MutableCharCollection
collectChar
(Iterator<T> iterator, CharFunction<? super T> charFunction) static <T,
R extends MutableCharCollection>
RcollectChar
(Iterator<T> iterator, CharFunction<? super T> charFunction, R target) static <T> MutableDoubleCollection
collectDouble
(Iterator<T> iterator, DoubleFunction<? super T> doubleFunction) static <T,
R extends MutableDoubleCollection>
RcollectDouble
(Iterator<T> iterator, DoubleFunction<? super T> doubleFunction, R target) static <T> MutableFloatCollection
collectFloat
(Iterator<T> iterator, FloatFunction<? super T> floatFunction) static <T,
R extends MutableFloatCollection>
RcollectFloat
(Iterator<T> iterator, FloatFunction<? super T> floatFunction, R target) static <T,
V, R extends Collection<V>>
RcollectIf
(Iterator<T> iterator, Predicate<? super T> predicate, Function<? super T, ? extends V> function, R targetCollection) static <T> MutableIntCollection
collectInt
(Iterator<T> iterator, IntFunction<? super T> intFunction) static <T,
R extends MutableIntCollection>
RcollectInt
(Iterator<T> iterator, IntFunction<? super T> intFunction, R target) static <T> MutableLongCollection
collectLong
(Iterator<T> iterator, LongFunction<? super T> longFunction) static <T,
R extends MutableLongCollection>
RcollectLong
(Iterator<T> iterator, LongFunction<? super T> longFunction, R target) static <T> MutableShortCollection
collectShort
(Iterator<T> iterator, ShortFunction<? super T> shortFunction) static <T,
R extends MutableShortCollection>
RcollectShort
(Iterator<T> iterator, ShortFunction<? super T> shortFunction, R target) static <T,
P, A, R extends Collection<A>>
RcollectWith
(Iterator<T> iterator, Function2<? super T, ? super P, ? extends A> function, P parameter, R targetCollection) static <T> int
static <T,
P> int countWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) static <T> T
static <T> int
detectIndex
(Iterator<T> iterator, Predicate<? super T> predicate) static <T,
IV> int detectIndexWith
(Iterator<T> iterator, Predicate2<? super T, ? super IV> predicate, IV injectedValue) static <T> Optional<T>
detectOptional
(Iterator<T> iterator, Predicate<? super T> predicate) static <T,
P> T detectWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) static <T,
P> Optional<T> detectWithOptional
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) static <T> MutableList<T>
static <T> MutableList<T>
distinct
(Iterator<T> iterator, HashingStrategy<? super T> hashingStrategy) static <T,
R extends List<T>>
RDeprecated.in 7.0.static <T,
R extends MutableCollection<T>>
Rstatic <T,
V, R extends Collection<V>>
RflatCollect
(Iterator<T> iterator, Function<? super T, ? extends Iterable<V>> function, R targetCollection) static <T> void
static <T,
P> void forEachWith
(Iterator<T> iterator, Procedure2<? super T, ? super P> procedure, P parameter) static <T> void
forEachWithIndex
(Iterator<T> iterator, ObjectIntProcedure<? super T> objectIntProcedure) static <T,
V> ImmutableMultimap<V, T> static <T,
V, R extends MutableMultimap<V, T>>
Rstatic <T,
V, R extends MutableMultimap<V, T>>
RgroupByEach
(Iterator<T> iterator, Function<? super T, ? extends Iterable<V>> function, R target) static <K,
T, R extends MutableMapIterable<K, T>>
RgroupByUniqueKey
(Iterator<T> iterator, Function<? super T, ? extends K> function, R target) static <T> double
injectInto
(double injectValue, Iterator<T> iterator, DoubleObjectToDoubleFunction<? super T> function) static <T> float
injectInto
(float injectValue, Iterator<T> iterator, FloatObjectToFloatFunction<? super T> function) static <T> int
injectInto
(int injectValue, Iterator<T> iterator, IntObjectToIntFunction<? super T> function) static <T> long
injectInto
(long injectValue, Iterator<T> iterator, LongObjectToLongFunction<? super T> function) static <T,
IV> IV injectInto
(IV injectValue, Iterator<T> iterator, Function2<? super IV, ? super T, ? extends IV> function) static <T,
IV, P> IV injectIntoWith
(IV injectValue, Iterator<T> iterator, Function3<? super IV, ? super T, ? super P, ? extends IV> function, P parameter) static <T> T
max
(Iterator<T> iterator, Comparator<? super T> comparator) static <T,
V extends Comparable<? super V>>
Tstatic <T> T
min
(Iterator<T> iterator, Comparator<? super T> comparator) static <T,
V extends Comparable<? super V>>
Tstatic <T> boolean
noneSatisfy
(Iterator<T> iterator, Predicate<? super T> predicate) static <T,
P> boolean noneSatisfyWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) static <T> PartitionMutableList<T>
static <T,
R extends PartitionMutableCollection<T>>
RpartitionWhile
(Iterator<T> iterator, Predicate<? super T> predicate, R target) static <T,
P> PartitionMutableList<T> partitionWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) static <T,
R extends Collection<T>>
Rstatic <T,
P, R extends Collection<T>>
RrejectWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection) static <T> boolean
static <T> boolean
static <T,
P> boolean removeIfWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) static <T,
P> boolean removeIfWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter, Procedure<? super T> procedure) static <T,
R extends Collection<T>>
Rstatic <T,
P> Twin<MutableList<T>> selectAndRejectWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) static <T,
R extends Collection<T>>
RselectInstancesOf
(Iterator<?> iterator, Class<T> clazz, R targetCollection) static <T,
P, R extends Collection<T>>
RselectWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P injectedValue, R targetCollection) static <T> boolean
shortCircuit
(Iterator<T> iterator, Predicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd) static <T,
P> boolean shortCircuitWith
(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate2, P parameter, boolean expected, boolean onShortCircuit, boolean atEnd) static <V,
T> MutableMap<V, BigDecimal> sumByBigDecimal
(Iterator<T> iterator, Function<? super T, ? extends V> groupBy, Function<? super T, BigDecimal> function) static <V,
T> MutableMap<V, BigInteger> sumByBigInteger
(Iterator<T> iterator, Function<? super T, ? extends V> groupBy, Function<? super T, BigInteger> function) static <T> BigDecimal
sumOfBigDecimal
(Iterator<T> iterator, Function<? super T, BigDecimal> function) static <T> BigInteger
sumOfBigInteger
(Iterator<T> iterator, Function<? super T, BigInteger> function) static <T> double
sumOfDouble
(Iterator<T> iterator, DoubleFunction<? super T> function) static <T> double
sumOfFloat
(Iterator<T> iterator, FloatFunction<? super T> function) static <T> long
sumOfInt
(Iterator<T> iterator, IntFunction<? super T> function) static <T> long
sumOfLong
(Iterator<T> iterator, LongFunction<? super T> function) static <T,
R extends MutableCollection<T>>
Rstatic <X,
Y, R extends Collection<Pair<X, Y>>>
Rstatic <T,
R extends Collection<Pair<T, Integer>>>
RzipWithIndex
(Iterator<T> iterator, R target)
-
Method Details
-
selectAndRejectWith
public static <T,P> Twin<MutableList<T>> selectAndRejectWith(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) -
partition
public static <T> PartitionMutableList<T> partition(Iterator<T> iterator, Predicate<? super T> predicate) - See Also:
-
partitionWith
public static <T,P> PartitionMutableList<T> partitionWith(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) - Since:
- 5.0
- See Also:
-
partitionWhile
public static <T,R extends PartitionMutableCollection<T>> R partitionWhile(Iterator<T> iterator, Predicate<? super T> predicate, R target) -
takeWhile
public static <T,R extends MutableCollection<T>> R takeWhile(Iterator<T> iterator, Predicate<? super T> predicate, R target) -
dropWhile
public static <T,R extends MutableCollection<T>> R dropWhile(Iterator<T> iterator, Predicate<? super T> predicate, R target) -
count
- See Also:
-
countWith
public static <T,P> int countWith(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) -
select
public static <T,R extends Collection<T>> R select(Iterator<T> iterator, Predicate<? super T> predicate, R targetCollection) -
selectWith
public static <T,P, R selectWithR extends Collection<T>> (Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P injectedValue, R targetCollection) -
selectInstancesOf
public static <T,R extends Collection<T>> R selectInstancesOf(Iterator<?> iterator, Class<T> clazz, R targetCollection) -
collectIf
public static <T,V, R collectIfR extends Collection<V>> (Iterator<T> iterator, Predicate<? super T> predicate, Function<? super T, ? extends V> function, R targetCollection) -
reject
public static <T,R extends Collection<T>> R reject(Iterator<T> iterator, Predicate<? super T> predicate, R targetCollection) -
rejectWith
public static <T,P, R rejectWithR extends Collection<T>> (Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter, R targetCollection) -
collect
public static <T,V, R collectR extends Collection<V>> (Iterator<T> iterator, Function<? super T, ? extends V> function, R targetCollection) -
collectBoolean
public static <T> MutableBooleanCollection collectBoolean(Iterator<T> iterator, BooleanFunction<? super T> booleanFunction) -
collectBoolean
public static <T,R extends MutableBooleanCollection> R collectBoolean(Iterator<T> iterator, BooleanFunction<? super T> booleanFunction, R target) -
collectByte
public static <T> MutableByteCollection collectByte(Iterator<T> iterator, ByteFunction<? super T> byteFunction) -
collectByte
public static <T,R extends MutableByteCollection> R collectByte(Iterator<T> iterator, ByteFunction<? super T> byteFunction, R target) -
collectChar
public static <T> MutableCharCollection collectChar(Iterator<T> iterator, CharFunction<? super T> charFunction) -
collectChar
public static <T,R extends MutableCharCollection> R collectChar(Iterator<T> iterator, CharFunction<? super T> charFunction, R target) -
collectDouble
public static <T> MutableDoubleCollection collectDouble(Iterator<T> iterator, DoubleFunction<? super T> doubleFunction) -
collectDouble
public static <T,R extends MutableDoubleCollection> R collectDouble(Iterator<T> iterator, DoubleFunction<? super T> doubleFunction, R target) -
collectFloat
public static <T> MutableFloatCollection collectFloat(Iterator<T> iterator, FloatFunction<? super T> floatFunction) -
collectFloat
public static <T,R extends MutableFloatCollection> R collectFloat(Iterator<T> iterator, FloatFunction<? super T> floatFunction, R target) -
collectInt
public static <T> MutableIntCollection collectInt(Iterator<T> iterator, IntFunction<? super T> intFunction) -
collectInt
public static <T,R extends MutableIntCollection> R collectInt(Iterator<T> iterator, IntFunction<? super T> intFunction, R target) -
collectLong
public static <T> MutableLongCollection collectLong(Iterator<T> iterator, LongFunction<? super T> longFunction) -
collectLong
public static <T,R extends MutableLongCollection> R collectLong(Iterator<T> iterator, LongFunction<? super T> longFunction, R target) -
collectShort
public static <T> MutableShortCollection collectShort(Iterator<T> iterator, ShortFunction<? super T> shortFunction) -
collectShort
public static <T,R extends MutableShortCollection> R collectShort(Iterator<T> iterator, ShortFunction<? super T> shortFunction, R target) -
flatCollect
public static <T,V, R flatCollectR extends Collection<V>> (Iterator<T> iterator, Function<? super T, ? extends Iterable<V>> function, R targetCollection) -
forEach
- See Also:
-
forEachWithIndex
public static <T> void forEachWithIndex(Iterator<T> iterator, ObjectIntProcedure<? super T> objectIntProcedure) -
detect
- See Also:
-
detectWith
public static <T,P> T detectWith(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) -
detectOptional
-
detectWithOptional
public static <T,P> Optional<T> detectWithOptional(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) -
injectInto
-
injectInto
public static <T> int injectInto(int injectValue, Iterator<T> iterator, IntObjectToIntFunction<? super T> function) -
injectInto
public static <T> long injectInto(long injectValue, Iterator<T> iterator, LongObjectToLongFunction<? super T> function) -
injectInto
public static <T> double injectInto(double injectValue, Iterator<T> iterator, DoubleObjectToDoubleFunction<? super T> function) -
injectInto
public static <T> float injectInto(float injectValue, Iterator<T> iterator, FloatObjectToFloatFunction<? super T> function) -
injectIntoWith
-
shortCircuit
-
shortCircuitWith
public static <T,P> boolean shortCircuitWith(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate2, P parameter, boolean expected, boolean onShortCircuit, boolean atEnd) -
anySatisfy
- See Also:
-
anySatisfyWith
public static <T,P> boolean anySatisfyWith(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) -
allSatisfy
- See Also:
-
allSatisfyWith
public static <T,P> boolean allSatisfyWith(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) -
noneSatisfy
- See Also:
-
noneSatisfyWith
public static <T,P> boolean noneSatisfyWith(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) -
removeIf
- See Also:
-
removeIfWith
public static <T,P> boolean removeIfWith(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter) -
removeIf
-
removeIfWith
public static <T,P> boolean removeIfWith(Iterator<T> iterator, Predicate2<? super T, ? super P> predicate, P parameter, Procedure<? super T> procedure) -
detectIndex
- See Also:
-
detectIndexWith
public static <T,IV> int detectIndexWith(Iterator<T> iterator, Predicate2<? super T, ? super IV> predicate, IV injectedValue) -
forEachWith
public static <T,P> void forEachWith(Iterator<T> iterator, Procedure2<? super T, ? super P> procedure, P parameter) -
collectWith
public static <T,P, R collectWithA, R extends Collection<A>> (Iterator<T> iterator, Function2<? super T, ? super P, ? extends A> function, P parameter, R targetCollection) -
groupBy
public static <T,V> ImmutableMultimap<V,T> groupBy(Iterator<T> iterator, Function<? super T, ? extends V> function) - See Also:
-
groupBy
public static <T,V, R groupByR extends MutableMultimap<V, T>> (Iterator<T> iterator, Function<? super T, ? extends V> function, R target) -
groupByEach
public static <T,V, R groupByEachR extends MutableMultimap<V, T>> (Iterator<T> iterator, Function<? super T, ? extends Iterable<V>> function, R target) -
groupByUniqueKey
public static <K,T, R groupByUniqueKeyR extends MutableMapIterable<K, T>> (Iterator<T> iterator, Function<? super T, ? extends K> function, R target) -
distinct
@Deprecated public static <T,R extends List<T>> R distinct(Iterator<T> iterator, R targetCollection) Deprecated.in 7.0. -
distinct
- Since:
- 7.0.
-
distinct
public static <T> MutableList<T> distinct(Iterator<T> iterator, HashingStrategy<? super T> hashingStrategy) - Since:
- 7.0.
-
zip
public static <X,Y, R zipR extends Collection<Pair<X, Y>>> (Iterator<X> xs, Iterator<Y> ys, R target) -
zipWithIndex
public static <T,R extends Collection<Pair<T, R zipWithIndexInteger>>> (Iterator<T> iterator, R target) -
chunk
- See Also:
-
min
- See Also:
-
max
- See Also:
-
advanceIteratorTo
-
sumOfInt
-
sumOfLong
-
sumOfFloat
-
sumOfDouble
-
sumOfBigDecimal
public static <T> BigDecimal sumOfBigDecimal(Iterator<T> iterator, Function<? super T, BigDecimal> function) -
sumOfBigInteger
public static <T> BigInteger sumOfBigInteger(Iterator<T> iterator, Function<? super T, BigInteger> function) -
sumByBigDecimal
public static <V,T> MutableMap<V,BigDecimal> sumByBigDecimal(Iterator<T> iterator, Function<? super T, ? extends V> groupBy, Function<? super T, BigDecimal> function) -
sumByBigInteger
public static <V,T> MutableMap<V,BigInteger> sumByBigInteger(Iterator<T> iterator, Function<? super T, ? extends V> groupBy, Function<? super T, BigInteger> function) -
aggregateBy
public static <T,K, MutableMap<K,V> V> aggregateBy(Iterator<T> iterator, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator) -
aggregateBy
public static <T,K, MutableMap<K,V> V> aggregateBy(Iterator<T> iterator, Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator) -
minBy
public static <T,V extends Comparable<? super V>> T minBy(Iterator<T> iterator, Function<? super T, ? extends V> function) -
maxBy
public static <T,V extends Comparable<? super V>> T maxBy(Iterator<T> iterator, Function<? super T, ? extends V> function)
-