Class IteratorIterate
java.lang.Object
org.eclipse.collections.impl.utility.internal.IteratorIterate
public final class IteratorIterate extends Object
The IteratorIterate class implementations of the various iteration patterns for use with java.util.Iterator.
-
Method Summary
Modifier and Type Method Description static <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> booleanallSatisfy(Iterator<T> iterator, Predicate<? super T> predicate)static <T, P> booleanallSatisfyWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter)static <T> booleananySatisfy(Iterator<T> iterator, Predicate<? super T> predicate)static <T, P> booleananySatisfyWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter)static <T> RichIterable<RichIterable<T>>chunk(Iterator<T> iterator, int size)static <T, V, R extends Collection<V>>
Rcollect(Iterator<T> iterator, Function<? super T,? extends V> function, R targetCollection)static <T> MutableBooleanCollectioncollectBoolean(Iterator<T> iterator, BooleanFunction<? super T> booleanFunction)static <T, R extends MutableBooleanCollection>
RcollectBoolean(Iterator<T> iterator, BooleanFunction<? super T> booleanFunction, R target)static <T> MutableByteCollectioncollectByte(Iterator<T> iterator, ByteFunction<? super T> byteFunction)static <T, R extends MutableByteCollection>
RcollectByte(Iterator<T> iterator, ByteFunction<? super T> byteFunction, R target)static <T> MutableCharCollectioncollectChar(Iterator<T> iterator, CharFunction<? super T> charFunction)static <T, R extends MutableCharCollection>
RcollectChar(Iterator<T> iterator, CharFunction<? super T> charFunction, R target)static <T> MutableDoubleCollectioncollectDouble(Iterator<T> iterator, DoubleFunction<? super T> doubleFunction)static <T, R extends MutableDoubleCollection>
RcollectDouble(Iterator<T> iterator, DoubleFunction<? super T> doubleFunction, R target)static <T> MutableFloatCollectioncollectFloat(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> MutableIntCollectioncollectInt(Iterator<T> iterator, IntFunction<? super T> intFunction)static <T, R extends MutableIntCollection>
RcollectInt(Iterator<T> iterator, IntFunction<? super T> intFunction, R target)static <T> MutableLongCollectioncollectLong(Iterator<T> iterator, LongFunction<? super T> longFunction)static <T, R extends MutableLongCollection>
RcollectLong(Iterator<T> iterator, LongFunction<? super T> longFunction, R target)static <T> MutableShortCollectioncollectShort(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> intcount(Iterator<T> iterator, Predicate<? super T> predicate)static <T, P> intcountWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter)static <T> Tdetect(Iterator<T> iterator, Predicate<? super T> predicate)static <T> intdetectIndex(Iterator<T> iterator, Predicate<? super T> predicate)static <T, IV> intdetectIndexWith(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> TdetectWith(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>distinct(Iterator<T> iterator)static <T> MutableList<T>distinct(Iterator<T> iterator, HashingStrategy<? super T> hashingStrategy)static <T, R extends List<T>>
Rdistinct(Iterator<T> iterator, R targetCollection)Deprecated.in 7.0.static <T, R extends MutableCollection<T>>
RdropWhile(Iterator<T> iterator, Predicate<? super T> predicate, R target)static <T, V, R extends Collection<V>>
RflatCollect(Iterator<T> iterator, Function<? super T,? extends Iterable<V>> function, R targetCollection)static <T> voidforEach(Iterator<T> iterator, Procedure<? super T> procedure)static <T, P> voidforEachWith(Iterator<T> iterator, Procedure2<? super T,? super P> procedure, P parameter)static <T> voidforEachWithIndex(Iterator<T> iterator, ObjectIntProcedure<? super T> objectIntProcedure)static <T, V> ImmutableMultimap<V,T>groupBy(Iterator<T> iterator, Function<? super T,? extends V> function)static <T, V, R extends MutableMultimap<V, T>>
RgroupBy(Iterator<T> iterator, Function<? super T,? extends V> function, R target)static <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> doubleinjectInto(double injectValue, Iterator<T> iterator, DoubleObjectToDoubleFunction<? super T> function)static <T> floatinjectInto(float injectValue, Iterator<T> iterator, FloatObjectToFloatFunction<? super T> function)static <T> intinjectInto(int injectValue, Iterator<T> iterator, IntObjectToIntFunction<? super T> function)static <T> longinjectInto(long injectValue, Iterator<T> iterator, LongObjectToLongFunction<? super T> function)static <T, IV> IVinjectInto(IV injectValue, Iterator<T> iterator, Function2<? super IV,? super T,? extends IV> function)static <T, IV, P> IVinjectIntoWith(IV injectValue, Iterator<T> iterator, Function3<? super IV,? super T,? super P,? extends IV> function, P parameter)static <T> Tmax(Iterator<T> iterator, Comparator<? super T> comparator)static <T, V extends Comparable<? super V>>
TmaxBy(Iterator<T> iterator, Function<? super T,? extends V> function)static <T> Tmin(Iterator<T> iterator, Comparator<? super T> comparator)static <T, V extends Comparable<? super V>>
TminBy(Iterator<T> iterator, Function<? super T,? extends V> function)static <T> booleannoneSatisfy(Iterator<T> iterator, Predicate<? super T> predicate)static <T, P> booleannoneSatisfyWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter)static <T> PartitionMutableList<T>partition(Iterator<T> iterator, Predicate<? super T> predicate)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>>
Rreject(Iterator<T> iterator, Predicate<? super T> predicate, R targetCollection)static <T, P, R extends Collection<T>>
RrejectWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection)static <T> booleanremoveIf(Iterator<T> iterator, Predicate<? super T> predicate)static <T> booleanremoveIf(Iterator<T> iterator, Predicate<? super T> predicate, Procedure<? super T> procedure)static <T, P> booleanremoveIfWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter)static <T, P> booleanremoveIfWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter, Procedure<? super T> procedure)static <T, R extends Collection<T>>
Rselect(Iterator<T> iterator, Predicate<? super T> predicate, R targetCollection)static <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> booleanshortCircuit(Iterator<T> iterator, Predicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd)static <T, P> booleanshortCircuitWith(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> BigDecimalsumOfBigDecimal(Iterator<T> iterator, Function<? super T,BigDecimal> function)static <T> BigIntegersumOfBigInteger(Iterator<T> iterator, Function<? super T,BigInteger> function)static <T> doublesumOfDouble(Iterator<T> iterator, DoubleFunction<? super T> function)static <T> doublesumOfFloat(Iterator<T> iterator, FloatFunction<? super T> function)static <T> longsumOfInt(Iterator<T> iterator, IntFunction<? super T> function)static <T> longsumOfLong(Iterator<T> iterator, LongFunction<? super T> function)static <T, R extends MutableCollection<T>>
RtakeWhile(Iterator<T> iterator, Predicate<? super T> predicate, R target)static <X, Y, R extends Collection<Pair<X, Y>>>
Rzip(Iterator<X> xs, Iterator<Y> ys, R target)static <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:
Iterate.partition(Iterable, Predicate)
-
partitionWith
public static <T, P> PartitionMutableList<T> partitionWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter)- Since:
- 5.0
- See Also:
Iterate.partitionWith(Iterable, Predicate2, Object)
-
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:
Iterate.count(Iterable, Predicate)
-
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 extends Collection<T>> R selectWith(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 extends Collection<V>> R collectIf(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 extends Collection<T>> R rejectWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter, R targetCollection) -
collect
public static <T, V, R extends Collection<V>> R collect(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 extends Collection<V>> R flatCollect(Iterator<T> iterator, Function<? super T,? extends Iterable<V>> function, R targetCollection) -
forEach
- See Also:
Iterate.forEach(Iterable, Procedure)
-
forEachWithIndex
public static <T> void forEachWithIndex(Iterator<T> iterator, ObjectIntProcedure<? super T> objectIntProcedure) -
detect
- See Also:
Iterate.detect(Iterable, Predicate)
-
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:
Iterate.anySatisfy(Iterable, Predicate)
-
anySatisfyWith
public static <T, P> boolean anySatisfyWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter) -
allSatisfy
- See Also:
Iterate.allSatisfy(Iterable, Predicate)
-
allSatisfyWith
public static <T, P> boolean allSatisfyWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter) -
noneSatisfy
- See Also:
Iterate.noneSatisfy(Iterable, Predicate)
-
noneSatisfyWith
public static <T, P> boolean noneSatisfyWith(Iterator<T> iterator, Predicate2<? super T,? super P> predicate, P parameter) -
removeIf
- See Also:
Iterate.removeIf(Iterable, Predicate)
-
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:
Iterate.detectIndex(Iterable, Predicate)
-
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, A, R extends Collection<A>> R collectWith(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:
Iterate.groupBy(Iterable, Function)
-
groupBy
public static <T, V, R extends MutableMultimap<V, T>> R groupBy(Iterator<T> iterator, Function<? super T,? extends V> function, R target) -
groupByEach
public static <T, V, R extends MutableMultimap<V, T>> R groupByEach(Iterator<T> iterator, Function<? super T,? extends Iterable<V>> function, R target) -
groupByUniqueKey
public static <K, T, R extends MutableMapIterable<K, T>> R groupByUniqueKey(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 extends Collection<Pair<X, Y>>> R zip(Iterator<X> xs, Iterator<Y> ys, R target) -
zipWithIndex
public static <T, R extends Collection<Pair<T, Integer>>> R zipWithIndex(Iterator<T> iterator, R target) -
chunk
- See Also:
Iterate.chunk(Iterable, int)
-
min
- See Also:
Iterate.min(Iterable, Comparator)
-
max
- See Also:
Iterate.max(Iterable, Comparator)
-
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, V> MutableMap<K,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, 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) -
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)
-