Package org.eclipse.collections.impl
Class AbstractRichIterable<T>
- java.lang.Object
-
- org.eclipse.collections.impl.AbstractRichIterable<T>
-
- All Implemented Interfaces:
Iterable<T>,InternalIterable<T>,RichIterable<T>
- Direct Known Subclasses:
AbstractBag,AbstractImmutableCollection,AbstractLazyIterable,AbstractMapIterable,AbstractMutableCollection
public abstract class AbstractRichIterable<T> extends Object implements RichIterable<T>
-
-
Constructor Summary
Constructors Constructor Description AbstractRichIterable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallSatisfy(Predicate<? super T> predicate)<P> booleanallSatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)booleananySatisfy(Predicate<? super T> predicate)<P> booleananySatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)voidappendString(Appendable appendable, String separator)voidappendString(Appendable appendable, String start, String separator, String end)LazyIterable<T>asLazy()<V,R extends Collection<V>>
Rcollect(Function<? super T,? extends V> function, R target)<V,R extends Collection<V>>
RcollectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function, R target)<P,V,R extends Collection<V>>
RcollectWith(Function2<? super T,? super P,? extends V> function, P parameter, R target)booleancontains(Object object)booleancontainsAll(Collection<?> collection)booleancontainsAllArguments(Object... elements)booleancontainsAllIterable(Iterable<?> source)intcount(Predicate<? super T> predicate)<V> Bag<V>countByEach(Function<? super T,? extends Iterable<V>> function)<P> intcountWith(Predicate2<? super T,? super P> predicate, P parameter)Tdetect(Predicate<? super T> predicate)Optional<T>detectOptional(Predicate<? super T> predicate)<P> TdetectWith(Predicate2<? super T,? super P> predicate, P parameter)<P> TdetectWithIfNone(Predicate2<? super T,? super P> predicate, P parameter, Function0<? extends T> function)<P> Optional<T>detectWithOptional(Predicate2<? super T,? super P> predicate, P parameter)<V,R extends Collection<V>>
RflatCollect(Function<? super T,? extends Iterable<V>> function, R target)voidforEach(Procedure<? super T> procedure)<P> voidforEachWith(Procedure2<? super T,? super P> procedure, P parameter)voidforEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)<V,R extends MutableMultimap<V,T>>
RgroupBy(Function<? super T,? extends V> function, R target)<V,R extends MutableMultimap<V,T>>
RgroupByEach(Function<? super T,? extends Iterable<V>> function, R target)<V,R extends MutableMapIterable<V,T>>
RgroupByUniqueKey(Function<? super T,? extends V> function, R target)doubleinjectInto(double injectedValue, DoubleObjectToDoubleFunction<? super T> function)floatinjectInto(float injectedValue, FloatObjectToFloatFunction<? super T> function)intinjectInto(int injectedValue, IntObjectToIntFunction<? super T> function)longinjectInto(long injectedValue, LongObjectToLongFunction<? super T> function)<IV> IVinjectInto(IV injectedValue, Function2<? super IV,? super T,? extends IV> function)<R extends Collection<T>>
Rinto(R target)booleanisEmpty()Tmax()Tmax(Comparator<? super T> comparator)<V extends Comparable<? super V>>
TmaxBy(Function<? super T,? extends V> function)Tmin()Tmin(Comparator<? super T> comparator)<V extends Comparable<? super V>>
TminBy(Function<? super T,? extends V> function)booleannoneSatisfy(Predicate<? super T> predicate)<P> booleannoneSatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)<R extends Collection<T>>
Rreject(Predicate<? super T> predicate, R target)<P,R extends Collection<T>>
RrejectWith(Predicate2<? super T,? super P> predicate, P parameter, R target)<R extends Collection<T>>
Rselect(Predicate<? super T> predicate, R target)<P,R extends Collection<T>>
RselectWith(Predicate2<? super T,? super P> predicate, P parameter, R target)doublesumOfDouble(DoubleFunction<? super T> function)doublesumOfFloat(FloatFunction<? super T> function)longsumOfInt(IntFunction<? super T> function)longsumOfLong(LongFunction<? super T> function)Object[]toArray()<E> E[]toArray(E[] array)MutableBag<T>toBag()<K,V>
MutableBiMap<K,V>toBiMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)MutableList<T>toList()<K,V>
MutableMap<K,V>toMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)MutableSet<T>toSet()MutableSortedBag<T>toSortedBag()MutableSortedBag<T>toSortedBag(Comparator<? super T> comparator)<V extends Comparable<? super V>>
MutableSortedBag<T>toSortedBagBy(Function<? super T,? extends V> function)<V extends Comparable<? super V>>
MutableList<T>toSortedListBy(Function<? super T,? extends V> function)<K,V>
MutableSortedMap<K,V>toSortedMap(Comparator<? super K> comparator, Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)<K,V>
MutableSortedMap<K,V>toSortedMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)<KK extends Comparable<? super KK>,NK,NV>
MutableSortedMap<NK,NV>toSortedMapBy(Function<? super NK,KK> sortBy, Function<? super T,? extends NK> keyFunction, Function<? super T,? extends NV> valueFunction)MutableSortedSet<T>toSortedSet()MutableSortedSet<T>toSortedSet(Comparator<? super T> comparator)<V extends Comparable<? super V>>
MutableSortedSet<T>toSortedSetBy(Function<? super T,? extends V> function)StringtoString()Returns a string with the elements of the iterable separated by commas with spaces and enclosed in square brackets.<S,R extends Collection<Pair<T,S>>>
Rzip(Iterable<S> that, R target)<R extends Collection<Pair<T,Integer>>>
RzipWithIndex(R target)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach
-
Methods inherited from interface java.lang.Iterable
iterator, spliterator
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, aggregateBy, aggregateInPlaceBy, appendString, chunk, collect, collectBoolean, collectBoolean, collectByte, collectByte, collectChar, collectChar, collectDouble, collectDouble, collectFloat, collectFloat, collectIf, collectInt, collectInt, collectLong, collectLong, collectShort, collectShort, collectWith, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, countBy, countBy, countByEach, countByWith, countByWith, detectIfNone, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, flatCollectWith, getAny, getFirst, getLast, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, makeString, makeString, makeString, makeString, maxByOptional, maxOptional, maxOptional, minByOptional, minOptional, minOptional, notEmpty, partition, partitionWith, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectInstancesOf, selectWith, size, sumByDouble, sumByFloat, sumByInt, sumByLong, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, tap, toImmutableBag, toImmutableBiMap, toImmutableList, toImmutableMap, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toMap, toSortedList, toSortedList, zip, zipWithIndex
-
-
-
-
Method Detail
-
contains
public boolean contains(Object object)
- Specified by:
containsin interfaceRichIterable<T>
-
containsAllIterable
public boolean containsAllIterable(Iterable<?> source)
- Specified by:
containsAllIterablein interfaceRichIterable<T>
-
containsAllArguments
public boolean containsAllArguments(Object... elements)
- Specified by:
containsAllArgumentsin interfaceRichIterable<T>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceRichIterable<T>
-
toArray
public <E> E[] toArray(E[] array)
- Specified by:
toArrayin interfaceRichIterable<T>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceRichIterable<T>
-
toList
public MutableList<T> toList()
- Specified by:
toListin interfaceRichIterable<T>
-
toSortedListBy
public <V extends Comparable<? super V>> MutableList<T> toSortedListBy(Function<? super T,? extends V> function)
- Specified by:
toSortedListByin interfaceRichIterable<T>
-
toSortedSet
public MutableSortedSet<T> toSortedSet()
- Specified by:
toSortedSetin interfaceRichIterable<T>
-
toSortedSet
public MutableSortedSet<T> toSortedSet(Comparator<? super T> comparator)
- Specified by:
toSortedSetin interfaceRichIterable<T>
-
toSortedSetBy
public <V extends Comparable<? super V>> MutableSortedSet<T> toSortedSetBy(Function<? super T,? extends V> function)
- Specified by:
toSortedSetByin interfaceRichIterable<T>
-
toSet
public MutableSet<T> toSet()
- Specified by:
toSetin interfaceRichIterable<T>
-
toBag
public MutableBag<T> toBag()
- Specified by:
toBagin interfaceRichIterable<T>
-
toSortedBag
public MutableSortedBag<T> toSortedBag()
- Specified by:
toSortedBagin interfaceRichIterable<T>
-
toSortedBag
public MutableSortedBag<T> toSortedBag(Comparator<? super T> comparator)
- Specified by:
toSortedBagin interfaceRichIterable<T>
-
toSortedBagBy
public <V extends Comparable<? super V>> MutableSortedBag<T> toSortedBagBy(Function<? super T,? extends V> function)
- Specified by:
toSortedBagByin interfaceRichIterable<T>
-
toMap
public <K,V> MutableMap<K,V> toMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)
- Specified by:
toMapin interfaceRichIterable<T>
-
toSortedMap
public <K,V> MutableSortedMap<K,V> toSortedMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)
- Specified by:
toSortedMapin interfaceRichIterable<T>
-
toSortedMap
public <K,V> MutableSortedMap<K,V> toSortedMap(Comparator<? super K> comparator, Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)
- Specified by:
toSortedMapin interfaceRichIterable<T>
-
toSortedMapBy
public <KK extends Comparable<? super KK>,NK,NV> MutableSortedMap<NK,NV> toSortedMapBy(Function<? super NK,KK> sortBy, Function<? super T,? extends NK> keyFunction, Function<? super T,? extends NV> valueFunction)
- Specified by:
toSortedMapByin interfaceRichIterable<T>
-
toBiMap
public <K,V> MutableBiMap<K,V> toBiMap(Function<? super T,? extends K> keyFunction, Function<? super T,? extends V> valueFunction)
- Specified by:
toBiMapin interfaceRichIterable<T>
-
select
public <R extends Collection<T>> R select(Predicate<? super T> predicate, R target)
- Specified by:
selectin interfaceRichIterable<T>
-
selectWith
public <P,R extends Collection<T>> R selectWith(Predicate2<? super T,? super P> predicate, P parameter, R target)
- Specified by:
selectWithin interfaceRichIterable<T>
-
reject
public <R extends Collection<T>> R reject(Predicate<? super T> predicate, R target)
- Specified by:
rejectin interfaceRichIterable<T>
-
rejectWith
public <P,R extends Collection<T>> R rejectWith(Predicate2<? super T,? super P> predicate, P parameter, R target)
- Specified by:
rejectWithin interfaceRichIterable<T>
-
collect
public <V,R extends Collection<V>> R collect(Function<? super T,? extends V> function, R target)
- Specified by:
collectin interfaceRichIterable<T>
-
collectWith
public <P,V,R extends Collection<V>> R collectWith(Function2<? super T,? super P,? extends V> function, P parameter, R target)
- Specified by:
collectWithin interfaceRichIterable<T>
-
collectIf
public <V,R extends Collection<V>> R collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function, R target)
- Specified by:
collectIfin interfaceRichIterable<T>
-
detectWithIfNone
public <P> T detectWithIfNone(Predicate2<? super T,? super P> predicate, P parameter, Function0<? extends T> function)
- Specified by:
detectWithIfNonein interfaceRichIterable<T>
-
min
public T min(Comparator<? super T> comparator)
- Specified by:
minin interfaceRichIterable<T>
-
max
public T max(Comparator<? super T> comparator)
- Specified by:
maxin interfaceRichIterable<T>
-
min
public T min()
- Specified by:
minin interfaceRichIterable<T>
-
max
public T max()
- Specified by:
maxin interfaceRichIterable<T>
-
minBy
public <V extends Comparable<? super V>> T minBy(Function<? super T,? extends V> function)
- Specified by:
minByin interfaceRichIterable<T>
-
maxBy
public <V extends Comparable<? super V>> T maxBy(Function<? super T,? extends V> function)
- Specified by:
maxByin interfaceRichIterable<T>
-
asLazy
public LazyIterable<T> asLazy()
- Specified by:
asLazyin interfaceRichIterable<T>
-
flatCollect
public <V,R extends Collection<V>> R flatCollect(Function<? super T,? extends Iterable<V>> function, R target)
- Specified by:
flatCollectin interfaceRichIterable<T>
-
detect
public T detect(Predicate<? super T> predicate)
- Specified by:
detectin interfaceRichIterable<T>
-
detectWith
public <P> T detectWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
detectWithin interfaceRichIterable<T>
-
detectOptional
public Optional<T> detectOptional(Predicate<? super T> predicate)
- Specified by:
detectOptionalin interfaceRichIterable<T>
-
detectWithOptional
public <P> Optional<T> detectWithOptional(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
detectWithOptionalin interfaceRichIterable<T>
-
anySatisfy
public boolean anySatisfy(Predicate<? super T> predicate)
- Specified by:
anySatisfyin interfaceRichIterable<T>
-
allSatisfy
public boolean allSatisfy(Predicate<? super T> predicate)
- Specified by:
allSatisfyin interfaceRichIterable<T>
-
noneSatisfy
public boolean noneSatisfy(Predicate<? super T> predicate)
- Specified by:
noneSatisfyin interfaceRichIterable<T>
-
anySatisfyWith
public <P> boolean anySatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
anySatisfyWithin interfaceRichIterable<T>
-
allSatisfyWith
public <P> boolean allSatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
allSatisfyWithin interfaceRichIterable<T>
-
noneSatisfyWith
public <P> boolean noneSatisfyWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
noneSatisfyWithin interfaceRichIterable<T>
-
count
public int count(Predicate<? super T> predicate)
- Specified by:
countin interfaceRichIterable<T>
-
countWith
public <P> int countWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
countWithin interfaceRichIterable<T>
-
injectInto
public <IV> IV injectInto(IV injectedValue, Function2<? super IV,? super T,? extends IV> function)- Specified by:
injectIntoin interfaceRichIterable<T>
-
injectInto
public int injectInto(int injectedValue, IntObjectToIntFunction<? super T> function)- Specified by:
injectIntoin interfaceRichIterable<T>
-
injectInto
public long injectInto(long injectedValue, LongObjectToLongFunction<? super T> function)- Specified by:
injectIntoin interfaceRichIterable<T>
-
injectInto
public double injectInto(double injectedValue, DoubleObjectToDoubleFunction<? super T> function)- Specified by:
injectIntoin interfaceRichIterable<T>
-
into
public <R extends Collection<T>> R into(R target)
- Specified by:
intoin interfaceRichIterable<T>
-
injectInto
public float injectInto(float injectedValue, FloatObjectToFloatFunction<? super T> function)- Specified by:
injectIntoin interfaceRichIterable<T>
-
sumOfInt
public long sumOfInt(IntFunction<? super T> function)
- Specified by:
sumOfIntin interfaceRichIterable<T>
-
sumOfFloat
public double sumOfFloat(FloatFunction<? super T> function)
- Specified by:
sumOfFloatin interfaceRichIterable<T>
-
sumOfLong
public long sumOfLong(LongFunction<? super T> function)
- Specified by:
sumOfLongin interfaceRichIterable<T>
-
sumOfDouble
public double sumOfDouble(DoubleFunction<? super T> function)
- Specified by:
sumOfDoublein interfaceRichIterable<T>
-
forEachWithIndex
public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
- Specified by:
forEachWithIndexin interfaceInternalIterable<T>
-
forEach
public final void forEach(Procedure<? super T> procedure)
- Specified by:
forEachin interfaceInternalIterable<T>- Specified by:
forEachin interfaceRichIterable<T>
-
forEachWith
public <P> void forEachWith(Procedure2<? super T,? super P> procedure, P parameter)
- Specified by:
forEachWithin interfaceInternalIterable<T>
-
zip
public <S,R extends Collection<Pair<T,S>>> R zip(Iterable<S> that, R target)
- Specified by:
zipin interfaceRichIterable<T>
-
zipWithIndex
public <R extends Collection<Pair<T,Integer>>> R zipWithIndex(R target)
- Specified by:
zipWithIndexin interfaceRichIterable<T>
-
toString
public String toString()
Returns a string with the elements of the iterable separated by commas with spaces and enclosed in square brackets.Assert.assertEquals("[]", Lists.mutable.empty().toString()); Assert.assertEquals("[1]", Lists.mutable.with(1).toString()); Assert.assertEquals("[1, 2, 3]", Lists.mutable.with(1, 2, 3).toString());- Specified by:
toStringin interfaceRichIterable<T>- Overrides:
toStringin classObject- Returns:
- a string representation of this collection.
- See Also:
AbstractCollection.toString()
-
appendString
public void appendString(Appendable appendable, String separator)
- Specified by:
appendStringin interfaceRichIterable<T>
-
appendString
public void appendString(Appendable appendable, String start, String separator, String end)
- Specified by:
appendStringin interfaceRichIterable<T>
-
containsAll
public boolean containsAll(Collection<?> collection)
- Specified by:
containsAllin interfaceRichIterable<T>
-
countByEach
public <V> Bag<V> countByEach(Function<? super T,? extends Iterable<V>> function)
- Specified by:
countByEachin interfaceRichIterable<T>- Since:
- 10.0.0
-
groupBy
public <V,R extends MutableMultimap<V,T>> R groupBy(Function<? super T,? extends V> function, R target)
- Specified by:
groupByin interfaceRichIterable<T>
-
groupByEach
public <V,R extends MutableMultimap<V,T>> R groupByEach(Function<? super T,? extends Iterable<V>> function, R target)
- Specified by:
groupByEachin interfaceRichIterable<T>
-
groupByUniqueKey
public <V,R extends MutableMapIterable<V,T>> R groupByUniqueKey(Function<? super T,? extends V> function, R target)
- Specified by:
groupByUniqueKeyin interfaceRichIterable<T>
-
-