| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final Iterable | |
| private final Function |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | allSatisfy(Predicate<? super V> predicate)
Overrides org. Implements org. Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty. |
| public boolean | anySatisfy(Predicate<? super V> predicate)
Overrides org. Implements org. Returns true if the predicate evaluates to true for any element of the iterable. |
| public V | detect(Predicate<? super V> predicate)
Overrides org. Implements org. Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true. |
| public Optional | detectOptional(Predicate<? super V> predicate)
Overrides org. Implements org. Returns the first element of the iterable for which the predicate evaluates to true as an Optional. |
| public void | each(Procedure<? super V> procedure)
Implements org. The procedure is executed for each element in the iterable. |
| public <P> void | forEachWith(Procedure2<? super V, ? super P> procedure, P parameter)
Overrides org. Implements org. The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument. |
| public void | forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure)
Overrides org. Implements org. Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure. |
| public V | getFirst()
Overrides org. Implements org. Returns the first element of an iterable. |
| public V | getLast()
Overrides org. Implements org. Returns the last element of an iterable. |
| public <IV> IV | injectInto(IV injectedValue, Function2<? super IV, ? super V, ? extends IV> f)
Overrides org. Implements org. Returns the final result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. |
| public int | injectInto(int injectedValue, IntObjectToIntFunction<? super V> f)
Overrides org. Implements org. Returns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. |
| public long | injectInto(long injectedValue, LongObjectToLongFunction<? super V> f)
Overrides org. Implements org. Returns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. |
| public double | injectInto(double injectedValue, DoubleObjectToDoubleFunction<? super V> f)
Overrides org. Implements org. Returns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. |
| public float | injectInto(float injectedValue, FloatObjectToFloatFunction<? super V> f)
Overrides org. Implements org. Returns the final float result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. |
| public boolean | isEmpty()
Overrides org. Implements org. Returns true if this iterable has zero items. |
| public Iterator | |
| public boolean | noneSatisfy(Predicate<? super V> predicate)
Overrides org. Implements org. Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty. |
| public boolean | notEmpty()
Overrides default org. The English equivalent of !this.isEmpty() |
| public int | size()
Overrides org. Implements org. Returns the number of items in this iterable. |
| adapted | back to summary |
|---|---|
| private final Iterable<T> adapted | |
| function | back to summary |
|---|---|
| private final Function<? super T, ? extends V> function | |
| CollectIterable | back to summary |
|---|---|
| public CollectIterable(Iterable<T> newAdapted, Function<? super T, ? extends V> function) | |
| allSatisfy | back to summary |
|---|---|
| public boolean allSatisfy(Predicate<? super V> predicate) Overrides org. Implements org. Doc from org. Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty. Otherwise, returns false.
| |
| anySatisfy | back to summary |
|---|---|
| public boolean anySatisfy(Predicate<? super V> predicate) Overrides org. Implements org. Doc from org. Returns 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.
| |
| detect | back to summary |
|---|---|
| public V detect(Predicate<? super V> predicate) Overrides org. Implements org. Doc from org. Returns 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"));
| |
| detectOptional | back to summary |
|---|---|
| public Optional Overrides org. Implements org. Doc from org. Returns 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"));
| |
| each | back to summary |
|---|---|
| public void each(Procedure<? super V> procedure) Implements org. Doc from org. The 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 of InternalIterable#forEach(Procedure)
that has a signature conflict with Iterable#forEach(java..
| |
| forEachWith | back to summary |
|---|---|
| public <P> void forEachWith(Procedure2<? super V, ? super P> procedure, P parameter) Overrides org. Implements org. Doc from org. The 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);
| |
| forEachWithIndex | back to summary |
|---|---|
| public void forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure) Overrides org. Implements org. Doc from org. Iterates 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());
}
});
| |
| getFirst | back to summary |
|---|---|
| public V getFirst() Overrides org. Implements org. Doc from org. Returns the first element of an iterable. In the case of a List it is the element at the first index. In the case of any other Collection, it is the first element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty. The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the first element could be any element from the Set.
| |
| getLast | back to summary |
|---|---|
| public V getLast() Overrides org. Implements org. Doc from org. Returns the last element of an iterable. In the case of a List it is the element at the last index. In the case of any other Collection, it is the last element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty. The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the last element could be any element from the Set.
| |
| injectInto | back to summary |
|---|---|
| public <IV> IV injectInto(IV injectedValue, Function2<? super IV, ? super V, ? extends IV> f) Overrides org. Implements org. Doc from org. Returns the final result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter. This method is commonly called fold or sometimes reduce.
| |
| injectInto | back to summary |
|---|---|
| public int injectInto(int injectedValue, IntObjectToIntFunction<? super V> f) Overrides org. Implements org. Doc from org. Returns the final int result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.
| |
| injectInto | back to summary |
|---|---|
| public long injectInto(long injectedValue, LongObjectToLongFunction<? super V> f) Overrides org. Implements org. Doc from org. Returns the final long result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.
| |
| injectInto | back to summary |
|---|---|
| public double injectInto(double injectedValue, DoubleObjectToDoubleFunction<? super V> f) Overrides org. Implements org. Doc from org. Returns the final double result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.
| |
| injectInto | back to summary |
|---|---|
| public float injectInto(float injectedValue, FloatObjectToFloatFunction<? super V> f) Overrides org. Implements org. Doc from org. Returns the final float result of evaluating function using each element of the iterable and the previous evaluation result as the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter.
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Overrides org. Implements org. Doc from org. Returns true if this iterable has zero items.
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over elements of type
| |
| noneSatisfy | back to summary |
|---|---|
| public boolean noneSatisfy(Predicate<? super V> predicate) Overrides org. Implements org. Doc from org. Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty. Otherwise, returns false.
| |
| notEmpty | back to summary |
|---|---|
| public boolean notEmpty() Overrides default org. Doc from org. The English equivalent of !this.isEmpty()
| |
| size | back to summary |
|---|---|
| public int size() Overrides org. Implements org. Doc from org. Returns the number of items in this iterable.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final Function | |
| private transient V | |
| private final Predicate | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public V | |
| public String |
| function | back to summary |
|---|---|
| private final Function<? super T, ? extends V> function | |
| functionResult | back to summary |
|---|---|
| private transient V functionResult | |
| predicate | back to summary |
|---|---|
| private final Predicate<? super V> predicate | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| AttributePredicate | back to summary |
|---|---|
| private AttributePredicate(Function<? super T, ? extends V> newFunction, Predicate<? super V> newPredicate) | |
| accept | back to summary |
|---|---|
| public boolean accept(T anObject) Implements org.
| |
| functionResult | back to summary |
|---|---|
| public V functionResult() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |