Package com.db4o.foundation
Class Iterators
- java.lang.Object
-
- com.db4o.foundation.Iterators
-
public class Iterators extends java.lang.Object
Iterator primitives (concat, map, reduce, filter, etc...).
-
-
Field Summary
Fields Modifier and Type Field Description static Iterable4
EMPTY_ITERABLE
static Iterator4
EMPTY_ITERATOR
static java.lang.Object
SKIP
Constant indicating that the current element in amap(com.db4o.foundation.Iterator4, com.db4o.foundation.Function4)
operation should be skipped.
-
Constructor Summary
Constructors Constructor Description Iterators()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
any(Iterator4 iterator, Predicate4 condition)
static Iterable4
append(Iterable4 front, java.lang.Object last)
static Iterable4
concat(Iterable4 iterables)
static Iterable4
concat(Iterable4... iterables)
static Iterator4
concat(Iterator4 iterators)
static Iterator4
concat(Iterator4... array)
static Iterator4
concat(Iterator4 first, Iterator4 second)
static Iterable4
concatMap(Iterable4 iterable, Function4 function)
static Iterator4
copy(Iterator4 iterator)
static Iterable4
crossProduct(Iterable4 iterables)
static Iterable4
crossProduct(Iterable4... iterables)
static Iterable4
enumerate(Iterable4 iterable)
GeneratesEnumerateIterator.Tuple
items with indexes starting at 0.static Iterable4
filter(Iterable4 source, Predicate4 predicate)
static Iterator4
filter(Iterator4 iterator, Predicate4 predicate)
static <T> Iterator4<T>
filter(T[] array, Predicate4<T> predicate)
static Iterator4
flatten(Iterator4 iterator)
Yields a flat sequence of elements.static Iterable4
iterable(Iterator4 iterator)
static <T> Iterable4
iterable(T... objects)
static <T> Iterator4
iterate(List4 list)
static <T> Iterator4
iterate(T... array)
static Iterator4
iterator(Iterable4 iterable)
static <T> Iterator4
iterator(java.util.Collection<T> c)
static java.lang.String
join(Iterable4 i, java.lang.String separator)
static java.lang.String
join(Iterator4 i, java.lang.String separator)
static java.lang.String
join(Iterator4 i, java.lang.String prefix, java.lang.String suffix, java.lang.String separator)
static Iterable4
map(Iterable4 iterable, Function4 function)
static Iterator4
map(Iterator4 iterator, Function4 function)
Returns a new iterator which yields the result of applying the function to every element in the original iterator.static Iterator4
map(java.lang.Object[] array, Function4 function)
static java.lang.Object
next(Iterator4 iterator)
static <T> java.util.Iterator<T>
platformIterator(Iterator4 iterator)
static Iterator4<java.lang.Integer>
range(int fromInclusive, int toExclusive)
static <T> Iterator4
revert(Iterator4<T> iterator)
static <T> Iterable4<T>
series(T seed, Function4<T,T> function)
static Iterable4
singletonIterable(java.lang.Object element)
static Iterator4
singletonIterator(java.lang.Object element)
static int
size(Iterable4 iterable)
static int
size(Iterator4 iterator)
static <T> Iterator4<T>
take(int count, Iterator4<T> iterator)
static java.lang.Object[]
toArray(Iterator4 tests)
static java.lang.Object[]
toArray(Iterator4 tests, ArrayFactory factory)
static java.lang.String
toString(Iterable4 i)
static java.lang.String
toString(Iterator4 i)
-
-
-
Field Detail
-
SKIP
public static final java.lang.Object SKIP
Constant indicating that the current element in amap(com.db4o.foundation.Iterator4, com.db4o.foundation.Function4)
operation should be skipped.
-
EMPTY_ITERATOR
public static final Iterator4 EMPTY_ITERATOR
-
EMPTY_ITERABLE
public static final Iterable4 EMPTY_ITERABLE
-
-
Method Detail
-
enumerate
public static Iterable4 enumerate(Iterable4 iterable)
GeneratesEnumerateIterator.Tuple
items with indexes starting at 0.- Parameters:
iterable
- the iterable to be enumerated
-
any
public static boolean any(Iterator4 iterator, Predicate4 condition)
-
map
public static Iterator4 map(Iterator4 iterator, Function4 function)
Returns a new iterator which yields the result of applying the function to every element in the original iterator.SKIP
can be returned from function to indicate the current element should be skipped.- Parameters:
iterator
-function
-- Returns:
-
filter
public static <T> Iterator4<T> filter(T[] array, Predicate4<T> predicate)
-
filter
public static Iterable4 filter(Iterable4 source, Predicate4 predicate)
-
filter
public static Iterator4 filter(Iterator4 iterator, Predicate4 predicate)
-
singletonIterable
public static Iterable4 singletonIterable(java.lang.Object element)
-
iterator
public static <T> Iterator4 iterator(java.util.Collection<T> c)
-
platformIterator
public static <T> java.util.Iterator<T> platformIterator(Iterator4 iterator)
-
iterate
public static <T> Iterator4 iterate(T... array)
-
size
public static int size(Iterable4 iterable)
-
next
public static java.lang.Object next(Iterator4 iterator)
-
size
public static int size(Iterator4 iterator)
-
toString
public static java.lang.String toString(Iterable4 i)
-
toString
public static java.lang.String toString(Iterator4 i)
-
join
public static java.lang.String join(Iterable4 i, java.lang.String separator)
-
join
public static java.lang.String join(Iterator4 i, java.lang.String separator)
-
join
public static java.lang.String join(Iterator4 i, java.lang.String prefix, java.lang.String suffix, java.lang.String separator)
-
toArray
public static java.lang.Object[] toArray(Iterator4 tests)
-
toArray
public static java.lang.Object[] toArray(Iterator4 tests, ArrayFactory factory)
-
flatten
public static Iterator4 flatten(Iterator4 iterator)
Yields a flat sequence of elements. AnyIterable4
orIterator4
found in the original sequence is recursively flattened.- Parameters:
iterator
- original sequence
-
iterable
public static <T> Iterable4 iterable(T... objects)
-
singletonIterator
public static Iterator4 singletonIterator(java.lang.Object element)
-
range
public static Iterator4<java.lang.Integer> range(int fromInclusive, int toExclusive)
-
-