| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final ListIterable |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static <T> ReverseIterable | |
| public void | each(Procedure<? super T> procedure)
Implements org. The procedure is executed for each element in the iterable. |
| public <P> void | forEachWith(Procedure2<? super T, ? 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 T> 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 T | getFirst()
Overrides org. Implements org. Returns the first element of an iterable. |
| public T | getLast()
Overrides org. Implements org. Returns the last element of an iterable. |
| public T | getOnly()
Overrides org. Overrides default org. Returns the element if the iterable has exactly one element. |
| public boolean | isEmpty()
Overrides org. Implements org. Returns true if this iterable has zero items. |
| public Iterator | |
| public int | size()
Overrides org. Implements org. Returns the number of items in this iterable. |
| adapted | back to summary |
|---|---|
| private final ListIterable<T> adapted | |
| ReverseIterable | back to summary |
|---|---|
| public ReverseIterable(ListIterable<T> newAdapted) | |
| adapt | back to summary |
|---|---|
| public static <T> ReverseIterable | |
| each | back to summary |
|---|---|
| public void each(Procedure<? super T> 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 T, ? 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 T> 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 T 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 T 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.
| |
| getOnly | back to summary |
|---|---|
| public T getOnly() Overrides org. Overrides default org. Doc from org. Returns the element if the iterable has exactly one element. Otherwise, throw
| |
| 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
| |
| 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 ListIterator |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public T | |
| public void | remove()
Overrides default java. Removes from the underlying collection the last element returned by this iterator (optional operation). |
| listIterator | back to summary |
|---|---|
| private final ListIterator<T> listIterator | |
| ReverseIterator | back to summary |
|---|---|
| private ReverseIterator(ListIterator<T> listIterator) | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public T next() Implements java. Doc from java. Returns the next element in the iteration.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
| |