Class CompositeIterable<E>
- java.lang.Object
-
- org.eclipse.collections.impl.AbstractRichIterable<T>
-
- org.eclipse.collections.impl.lazy.AbstractLazyIterable<E>
-
- org.eclipse.collections.impl.lazy.CompositeIterable<E>
-
- All Implemented Interfaces:
java.lang.Iterable<E>,InternalIterable<E>,LazyIterable<E>,RichIterable<E>
public final class CompositeIterable<E> extends AbstractLazyIterable<E>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classCompositeIterable.CompositeIterator
-
Field Summary
Fields Modifier and Type Field Description private MutableList<java.lang.Iterable<E>>iterables
-
Constructor Summary
Constructors Modifier Constructor Description CompositeIterable()privateCompositeIterable(MutableList<java.lang.Iterable<E>> newIterables)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.Iterable<E> iterable)booleanallSatisfy(Predicate<? super E> predicate)Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty.booleananySatisfy(Predicate<? super E> predicate)Returns true if the predicate evaluates to true for any element of the iterable.Edetect(Predicate<? super E> predicate)Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true.java.util.Optional<E>detectOptional(Predicate<? super E> predicate)Returns the first element of the iterable for which the predicate evaluates to true as an Optional.voideach(Procedure<? super E> procedure)The procedure is executed for each element in the iterable.<P> voidforEachWith(Procedure2<? super E,? super P> procedure, P parameter)The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.voidforEachWithIndex(ObjectIntProcedure<? super E> objectIntProcedure)Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.java.util.Iterator<E>iterator()booleannoneSatisfy(Predicate<? super E> predicate)Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty.intsize()Returns the number of items in this iterable.static <T> CompositeIterable<T>with(java.lang.Iterable<T>... iterables)-
Methods inherited from class org.eclipse.collections.impl.lazy.AbstractLazyIterable
asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, concatenate, distinct, drop, dropWhile, flatCollect, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, into, isEmpty, maxByOptional, maxOptional, maxOptional, minByOptional, minOptional, minOptional, partition, partitionWith, reject, rejectWith, select, selectInstancesOf, selectWith, sumByDouble, sumByFloat, sumByInt, sumByLong, take, takeWhile, tap, toStack, zip, zipWithIndex
-
Methods inherited from class org.eclipse.collections.impl.AbstractRichIterable
allSatisfyWith, anySatisfyWith, appendString, appendString, collect, collectIf, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countByEach, countWith, detectWith, detectWithIfNone, detectWithOptional, flatCollect, forEach, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, max, max, maxBy, min, min, minBy, noneSatisfyWith, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toBiMap, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach
-
Methods inherited from interface org.eclipse.collections.api.LazyIterable
flatCollectWith, toArray, toArray, toImmutableBag, toImmutableList, toImmutableSet
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, aggregateBy, aggregateInPlaceBy, allSatisfyWith, anySatisfyWith, appendString, appendString, appendString, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countBy, countByEach, countByEach, countByWith, countByWith, countWith, detectIfNone, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, makeString, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfyWith, notEmpty, reduce, reduceBy, reduceBy, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toBiMap, toImmutableBiMap, toImmutableMap, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
-
-
-
-
Field Detail
-
iterables
private final MutableList<java.lang.Iterable<E>> iterables
-
-
Constructor Detail
-
CompositeIterable
private CompositeIterable(MutableList<java.lang.Iterable<E>> newIterables)
-
CompositeIterable
public CompositeIterable()
-
-
Method Detail
-
with
public static <T> CompositeIterable<T> with(java.lang.Iterable<T>... iterables)
-
each
public void each(Procedure<? super E> procedure)
Description copied from interface:RichIterableThe procedure is executed for each element in the iterable.Example using a Java 8 lambda expression:
people.each(person -> LOGGER.info(person.getName()));
This method is a variant ofInternalIterable.forEach(Procedure)that has a signature conflict withIterable.forEach(java.util.function.Consumer).- See Also:
InternalIterable.forEach(Procedure),Iterable.forEach(java.util.function.Consumer)
-
forEachWithIndex
public void forEachWithIndex(ObjectIntProcedure<? super E> objectIntProcedure)
Description copied from interface:InternalIterableIterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.Example using a Java 8 lambda:
people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));Example using an anonymous inner class:
people.forEachWithIndex(new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info("Index: " + index + " person: " + person.getName()); } });- Specified by:
forEachWithIndexin interfaceInternalIterable<E>- Overrides:
forEachWithIndexin classAbstractRichIterable<E>
-
forEachWith
public <P> void forEachWith(Procedure2<? super E,? super P> procedure, P parameter)
Description copied from interface:InternalIterableThe procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.Example using a Java 8 lambda:
people.forEachWith((Person person, Person other) -> { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } }, fred);Example using an anonymous inner class:
people.forEachWith(new Procedure2<Person, Person>() { public void value(Person person, Person other) { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } } }, fred);- Specified by:
forEachWithin interfaceInternalIterable<E>- Overrides:
forEachWithin classAbstractRichIterable<E>
-
anySatisfy
public boolean anySatisfy(Predicate<? super E> predicate)
Description copied from interface:RichIterableReturns true if the predicate evaluates to true for any element of the iterable. Returns false if the iterable is empty, or if no element returned true when evaluating the predicate.- Specified by:
anySatisfyin interfaceRichIterable<E>- Overrides:
anySatisfyin classAbstractRichIterable<E>
-
allSatisfy
public boolean allSatisfy(Predicate<? super E> predicate)
Description copied from interface:RichIterableReturns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty. Otherwise, returns false.- Specified by:
allSatisfyin interfaceRichIterable<E>- Overrides:
allSatisfyin classAbstractRichIterable<E>
-
noneSatisfy
public boolean noneSatisfy(Predicate<? super E> predicate)
Description copied from interface:RichIterableReturns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty. Otherwise, returns false.- Specified by:
noneSatisfyin interfaceRichIterable<E>- Overrides:
noneSatisfyin classAbstractRichIterable<E>
-
detect
public E detect(Predicate<? super E> predicate)
Description copied from interface:RichIterableReturns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true. This method is commonly called find.Example using a Java 8 lambda expression:
Person person = people.detect(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));- Specified by:
detectin interfaceRichIterable<E>- Overrides:
detectin classAbstractRichIterable<E>
-
detectOptional
public java.util.Optional<E> detectOptional(Predicate<? super E> predicate)
Description copied from interface:RichIterableReturns the first element of the iterable for which the predicate evaluates to true as an Optional. This method is commonly called find.Example using a Java 8 lambda expression:
Person person = people.detectOptional(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));- Specified by:
detectOptionalin interfaceRichIterable<E>- Overrides:
detectOptionalin classAbstractRichIterable<E>
-
add
public void add(java.lang.Iterable<E> iterable)
-
size
public int size()
Description copied from interface:RichIterableReturns the number of items in this iterable.- Specified by:
sizein interfaceRichIterable<E>- Overrides:
sizein classAbstractLazyIterable<E>
-
iterator
public java.util.Iterator<E> iterator()
-
-