public abstract class Iterations extends Object
| Constructor and Description |
|---|
Iterations() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Iterable<T> |
iterable()
Creates an empty iterable.
|
static <T> Iterable<T> |
iterable(T... values)
Creates an iterable from the passed array.
|
static <T> Iterable<T> |
iterable(T value)
Creates an iterable from the passed value.
|
static <T> Iterable<T> |
iterable(T first,
T second)
Creates an iterable from the passed values.
|
static <T> Iterable<T> |
iterable(T first,
T second,
T third)
Creates an iterable from the passed values.
|
static <T> Iterator<T> |
iterator()
Creates an empty iterator
|
static <T> Iterator<T> |
iterator(Provider<Maybe<T>> generator)
An iterator generated by a
Provider providing the next item or nothing when
the iteration should be completed. |
static <T> Iterator<T> |
iterator(T... values)
Creates an iterator from the passed array.
|
static <T> Iterator<T> |
iterator(T value)
Creates an iterator from the passed value.
|
static <T> Iterator<T> |
iterator(T seed,
Delegate<Maybe<T>,T> generator)
An iterator generated by iterative application of the
generator function
providing the next item or nothing when the iteration should be completed. |
static <T> Iterator<T> |
iterator(T first,
T second)
Creates an iterator from the passed values.
|
static <T> Iterator<T> |
iterator(T first,
T second,
T third)
Creates an iterator from the passed values.
|
static <T> Iterable<T> |
oneTime(Iterator<T> iterator)
Creates an iterable usable only ONE TIME from an iterator.
|
public static <T> Iterable<T> oneTime(Iterator<T> iterator)
T - the iterator element type parameteriterator - the iterator to be yielded by the iterablepublic static <T> Iterator<T> iterator()
T - the element parameter typepublic static <T> Iterator<T> iterator(T value)
T - the element parameter typevalue - the value to be yielded by the iteratorpublic static <T> Iterator<T> iterator(T first, T second)
T - the elements parameter typefirst - the first elementsecond - the second elementpublic static <T> Iterator<T> iterator(T first, T second, T third)
T - the elements parameter typefirst - the first elementsecond - the second elementthird - the third elementpublic static <T> Iterator<T> iterator(T... values)
T - the array element parameter typevalues - the values to be yielded by the iteratorpublic static <T> Iterator<T> iterator(Provider<Maybe<T>> generator)
Provider providing the next item or nothing when
the iteration should be completed.T - the elements parameter typegenerator - the generator of the values to be yielded by the iteratorpublic static <T> Iterator<T> iterator(T seed, Delegate<Maybe<T>,T> generator)
generator function
providing the next item or nothing when the iteration should be completed.
The seed is the first item of the sequence, then each item is generated
calling the function with the previous generated item, producing the sequence
seed, f(seed), f(f(seed)), ....T - the elements parameter typeseed - the initial input element passed to the generator functiongenerator - the generator of the values to be yielded by the iteratorpublic static <T> Iterable<T> iterable()
T - the element parameter typepublic static <T> Iterable<T> iterable(T value)
T - the element parameter typevalue - the value to be yielded by the iteratorpublic static <T> Iterable<T> iterable(T first, T second)
T - the elements parameter typefirst - the first elementsecond - the second elementpublic static <T> Iterable<T> iterable(T first, T second, T third)
T - the elements parameter typefirst - the first elementsecond - the second elementthird - the third elementpublic static <T> Iterable<T> iterable(T... values)
T - the array element parameter typevalues - the values to be yielded by the iteratorCopyright © 2016. All rights reserved.