java.lang.Iterable<E>, InternalIterable<E>, LazyIterable<E>, RichIterable<E>public final class CompositeIterable<E> extends AbstractLazyIterable<E>
| Constructor | Description |
|---|---|
CompositeIterable() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
add(java.lang.Iterable<E> iterable) |
|
boolean |
allSatisfy(Predicate<? super E> predicate) |
Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty.
|
boolean |
anySatisfy(Predicate<? super E> predicate) |
Returns true if the predicate evaluates to true for any element of the iterable.
|
E |
detect(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.
|
void |
each(Procedure<? super E> procedure) |
The procedure is executed for each element in the iterable.
|
<P> void |
forEachWith(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.
|
void |
forEachWithIndex(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() |
|
boolean |
noneSatisfy(Predicate<? super E> predicate) |
Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty.
|
int |
size() |
Returns the number of items in this iterable.
|
static <T> CompositeIterable<T> |
with(java.lang.Iterable<T>... iterables) |
aggregateBy, aggregateInPlaceBy, 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, toArray, toStack, zip, zipWithIndexallSatisfyWith, anySatisfyWith, appendString, appendString, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, 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, toArray, toBag, toBiMap, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndexforEachflatCollectWithequals, getClass, hashCode, notify, notifyAll, wait, wait, waitallSatisfyWith, anySatisfyWith, appendString, appendString, appendString, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countBy, countBy, countByEach, countByEach, countByWith, countByWith, countWith, detectIfNone, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectWith, forEach, getAny, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfyWith, notEmpty, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toBag, toBiMap, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndexpublic static <T> CompositeIterable<T> with(java.lang.Iterable<T>... iterables)
public void each(Procedure<? super E> procedure)
RichIterableExample using a Java 8 lambda expression:
people.each(person -> LOGGER.info(person.getName()));
Example using an anonymous inner class:
people.each(new Procedure<Person>()
{
public void value(Person person)
{
LOGGER.info(person.getName());
}
});
This method is a variant of InternalIterable.forEach(Procedure)
that has a signature conflict with Iterable.forEach(java.util.function.Consumer).InternalIterable.forEach(Procedure),
Iterable.forEach(java.util.function.Consumer)public void forEachWithIndex(ObjectIntProcedure<? super E> objectIntProcedure)
InternalIterableExample 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());
}
});
forEachWithIndex in interface InternalIterable<E>forEachWithIndex in class AbstractRichIterable<E>public <P> void forEachWith(Procedure2<? super E,? super P> procedure, P parameter)
InternalIterableExample 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);
forEachWith in interface InternalIterable<E>forEachWith in class AbstractRichIterable<E>public boolean anySatisfy(Predicate<? super E> predicate)
RichIterableanySatisfy in interface RichIterable<E>anySatisfy in class AbstractRichIterable<E>public boolean allSatisfy(Predicate<? super E> predicate)
RichIterableallSatisfy in interface RichIterable<E>allSatisfy in class AbstractRichIterable<E>public boolean noneSatisfy(Predicate<? super E> predicate)
RichIterablenoneSatisfy in interface RichIterable<E>noneSatisfy in class AbstractRichIterable<E>public E detect(Predicate<? super E> predicate)
RichIterableExample using a Java 8 lambda expression:
Person person =
people.detect(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));
Example using an anonymous inner class:
Person person =
people.detect(new Predicate<Person>()
{
public boolean accept(Person person)
{
return person.getFirstName().equals("John") && person.getLastName().equals("Smith");
}
});
detect in interface RichIterable<E>detect in class AbstractRichIterable<E>public java.util.Optional<E> detectOptional(Predicate<? super E> predicate)
RichIterableExample using a Java 8 lambda expression:
Person person =
people.detectOptional(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));
detectOptional in interface RichIterable<E>detectOptional in class AbstractRichIterable<E>public void add(java.lang.Iterable<E> iterable)
public int size()
RichIterablesize in interface RichIterable<E>size in class AbstractLazyIterable<E>public java.util.Iterator<E> iterator()
Copyright © 2004–2020. All rights reserved.