public class ObjectIterators
extends java.lang.Object
| Constructor and Description |
|---|
ObjectIterators() |
| Modifier and Type | Method and Description |
|---|---|
static <T,E> ObjectIterator<E> |
arrayFlatMap(java.util.Iterator<? extends T> iterator,
Object2ObjectFunction<T,E[]> mapper)
A Helper function that flatMaps a Java-Iterator into a new Type.
|
static <T,E> ObjectIterator<E> |
arrayFlatMap(ObjectIterator<T> iterator,
Object2ObjectFunction<T,E[]> mapper)
A Helper function that flatMaps a Iterator into a new Type.
|
static <T> ObjectIterator<T> |
concat(ObjectIterator<T>... array)
Helper Iterator that concats other iterators together
|
static <T> ObjectIterator<T> |
concat(ObjectIterator<T>[] array,
int offset,
int length)
Helper Iterator that concats other iterators together
|
static <T> ObjectIterator<T> |
distinct(java.util.Iterator<? extends T> iterator)
A Helper function that filters out all duplicated elements from a Java Iterator.
|
static <T> ObjectIterator<T> |
distinct(ObjectIterator<T> iterator)
A Helper function that filters out all duplicated elements.
|
static <T> speiger.src.collections.objects.utils.ObjectIterators.EmptyIterator<T> |
empty()
Returns a Immutable EmptyIterator instance that is automatically casted.
|
static <T> ObjectIterator<T> |
filter(java.util.Iterator<? extends T> iterator,
Object2BooleanFunction<T> filter)
A Helper function that filters out all desired elements from a Java-Iterator
|
static <T> ObjectIterator<T> |
filter(ObjectIterator<T> iterator,
Object2BooleanFunction<T> filter)
A Helper function that filters out all desired elements
|
static <T,E,V extends java.lang.Iterable<E>> |
flatMap(java.util.Iterator<? extends T> iterator,
Object2ObjectFunction<T,V> mapper)
A Helper function that flatMaps a Java-Iterator into a new Type.
|
static <T,E,V extends java.lang.Iterable<E>> |
flatMap(ObjectIterator<T> iterator,
Object2ObjectFunction<T,V> mapper)
A Helper function that flatMaps a Iterator into a new Type.
|
static <T> ObjectBidirectionalIterator<T> |
invert(ObjectBidirectionalIterator<T> it)
Inverter function for Bidirectional Iterators
|
static <T> ObjectListIterator<T> |
invert(ObjectListIterator<T> it)
Inverter function for List Iterators
|
static <T> ObjectIterator<T> |
limit(java.util.Iterator<? extends T> iterator,
long limit)
A Helper function that hard limits the Iterator to a specific size from a Java Iterator
|
static <T> ObjectIterator<T> |
limit(ObjectIterator<T> iterator,
long limit)
A Helper function that hard limits the Iterator to a specific size
|
static <T,E> ObjectIterator<E> |
map(java.util.Iterator<? extends T> iterator,
Object2ObjectFunction<T,E> mapper)
A Helper function that maps a Java-Iterator into a new Type.
|
static <T,E> ObjectIterator<E> |
map(ObjectIterator<T> iterator,
Object2ObjectFunction<T,E> mapper)
A Helper function that maps a Iterator into a new Type.
|
static <T> ObjectIterator<T> |
peek(java.util.Iterator<? extends T> iterator,
java.util.function.Consumer<T> action)
A Helper function that allows to preview the result of a Iterator from a Java Iterator
|
static <T> ObjectIterator<T> |
peek(ObjectIterator<T> iterator,
java.util.function.Consumer<T> action)
A Helper function that allows to preview the result of a Iterator.
|
static <T> ObjectList<T> |
pour(ObjectIterator<T> iter)
A Helper function to pours all elements of a Iterator into a List
|
static <T> ObjectList<T> |
pour(ObjectIterator<T> iter,
int max)
A Helper function to pours all elements of a Iterator into a List
|
static <T> int |
pour(ObjectIterator<T> iter,
ObjectCollection<T> c)
A Helper function to pours all elements of a Iterator into a Collection
|
static <T> int |
pour(ObjectIterator<T> iter,
ObjectCollection<T> c,
int max)
A Helper function to pours all elements of a Iterator into a Collection
|
static <T> ObjectIterator<T> |
sorted(java.util.Iterator<? extends T> iterator,
java.util.Comparator<T> sorter)
A Helper function that sorts the Iterator beforehand from a Java Iterator.
|
static <T> ObjectIterator<T> |
sorted(ObjectIterator<T> iterator,
java.util.Comparator<T> sorter)
A Helper function that sorts the Iterator beforehand.
|
static <T> ObjectBidirectionalIterator<T> |
unmodifiable(ObjectBidirectionalIterator<T> iterator)
Returns a Immutable Iterator instance based on the instance given.
|
static <T> ObjectIterator<T> |
unmodifiable(ObjectIterator<T> iterator)
Returns a Immutable Iterator instance based on the instance given.
|
static <T> ObjectListIterator<T> |
unmodifiable(ObjectListIterator<T> iterator)
Returns a Immutable ListIterator instance based on the instance given.
|
static <T> int |
unwrap(T[] a,
java.util.Iterator<? extends T> i)
Iterates over a iterator and inserts the values into the array and returns the amount that was inserted
|
static <T> int |
unwrap(T[] a,
java.util.Iterator<? extends T> i,
int offset)
Iterates over a iterator and inserts the values into the array and returns the amount that was inserted
|
static <T> int |
unwrap(T[] a,
java.util.Iterator<? extends T> i,
int offset,
int max)
Iterates over a iterator and inserts the values into the array and returns the amount that was inserted
|
static <T> int |
unwrap(T[] a,
ObjectIterator<T> i)
A Primitive iterator variant of the ObjectIterators unwrap function
Iterates over a iterator and inserts the values into the array and returns the amount that was inserted
|
static <T> int |
unwrap(T[] a,
ObjectIterator<T> i,
int offset)
A Primitive iterator variant of the ObjectIterators unwrap function
Iterates over a iterator and inserts the values into the array and returns the amount that was inserted
|
static <T> int |
unwrap(T[] a,
ObjectIterator<T> i,
int offset,
int max)
A Primitive iterator variant of the ObjectIterators unwrap function
Iterates over a iterator and inserts the values into the array and returns the amount that was inserted
|
static <T> ObjectIterator<T> |
wrap(java.util.Iterator<? extends T> iterator)
Helper function to convert a Object Iterator into a Primitive Iterator
|
static <T> speiger.src.collections.objects.utils.ObjectIterators.ArrayIterator<T> |
wrap(T... a)
Returns a Array Wrapping iterator
|
static <T> speiger.src.collections.objects.utils.ObjectIterators.ArrayIterator<T> |
wrap(T[] a,
int start,
int end)
Returns a Array Wrapping iterator
|
public static <T> speiger.src.collections.objects.utils.ObjectIterators.EmptyIterator<T> empty()
T - the type of elements maintained by this Collectionpublic static <T> ObjectBidirectionalIterator<T> invert(ObjectBidirectionalIterator<T> it)
T - the type of elements maintained by this Collectionit - the iterator that should be invertedpublic static <T> ObjectListIterator<T> invert(ObjectListIterator<T> it)
T - the type of elements maintained by this Collectionit - the iterator that should be invertedpublic static <T> ObjectIterator<T> unmodifiable(ObjectIterator<T> iterator)
T - the type of elements maintained by this Collectioniterator - that should be made immutable/unmodifiablepublic static <T> ObjectBidirectionalIterator<T> unmodifiable(ObjectBidirectionalIterator<T> iterator)
T - the type of elements maintained by this Collectioniterator - that should be made immutable/unmodifiablepublic static <T> ObjectListIterator<T> unmodifiable(ObjectListIterator<T> iterator)
T - the type of elements maintained by this Collectioniterator - that should be made immutable/unmodifiablepublic static <T,E> ObjectIterator<E> map(java.util.Iterator<? extends T> iterator, Object2ObjectFunction<T,E> mapper)
T - the type of elements maintained by this CollectionE - The return type.iterator - that should be mappedmapper - the function that decides what the result turns into.public static <T,E> ObjectIterator<E> map(ObjectIterator<T> iterator, Object2ObjectFunction<T,E> mapper)
T - the type of elements maintained by this CollectionE - The return type.iterator - that should be mappedmapper - the function that decides what the result turns into.public static <T,E,V extends java.lang.Iterable<E>> ObjectIterator<E> flatMap(java.util.Iterator<? extends T> iterator, Object2ObjectFunction<T,V> mapper)
T - the type of elements maintained by this CollectionV - The return type supplier.E - The return type.iterator - that should be flatMappedmapper - the function that decides what the result turns into.public static <T,E,V extends java.lang.Iterable<E>> ObjectIterator<E> flatMap(ObjectIterator<T> iterator, Object2ObjectFunction<T,V> mapper)
T - the type of elements maintained by this CollectionV - The return type supplier.E - The return type.iterator - that should be flatMappedmapper - the function that decides what the result turns into.public static <T,E> ObjectIterator<E> arrayFlatMap(java.util.Iterator<? extends T> iterator, Object2ObjectFunction<T,E[]> mapper)
T - the type of elements maintained by this CollectionE - The return type.iterator - that should be flatMappedmapper - the function that decides what the result turns into.public static <T,E> ObjectIterator<E> arrayFlatMap(ObjectIterator<T> iterator, Object2ObjectFunction<T,E[]> mapper)
T - the type of elements maintained by this CollectionE - The return type.iterator - that should be flatMappedmapper - the function that decides what the result turns into.public static <T> ObjectIterator<T> filter(java.util.Iterator<? extends T> iterator, Object2BooleanFunction<T> filter)
T - the type of elements maintained by this Collectioniterator - that should be filtered.filter - the filter that decides that should be let throughpublic static <T> ObjectIterator<T> filter(ObjectIterator<T> iterator, Object2BooleanFunction<T> filter)
T - the type of elements maintained by this Collectioniterator - that should be filtered.filter - the filter that decides that should be let throughpublic static <T> ObjectIterator<T> distinct(ObjectIterator<T> iterator)
T - the type of elements maintained by this Collectioniterator - that should be distinctpublic static <T> ObjectIterator<T> distinct(java.util.Iterator<? extends T> iterator)
T - the type of elements maintained by this Collectioniterator - that should be distinctpublic static <T> ObjectIterator<T> limit(ObjectIterator<T> iterator, long limit)
T - the type of elements maintained by this Collectioniterator - that should be limitedlimit - the amount of elements it should be limited topublic static <T> ObjectIterator<T> limit(java.util.Iterator<? extends T> iterator, long limit)
T - the type of elements maintained by this Collectioniterator - that should be limitedlimit - the amount of elements it should be limited topublic static <T> ObjectIterator<T> sorted(ObjectIterator<T> iterator, java.util.Comparator<T> sorter)
T - the type of elements maintained by this Collectioniterator - that should be sorted.sorter - the sorter of the iterator. Can be null.public static <T> ObjectIterator<T> sorted(java.util.Iterator<? extends T> iterator, java.util.Comparator<T> sorter)
T - the type of elements maintained by this Collectioniterator - that should be sorted.sorter - the sorter of the iterator. Can be null.public static <T> ObjectIterator<T> peek(ObjectIterator<T> iterator, java.util.function.Consumer<T> action)
T - the type of elements maintained by this Collectioniterator - that should be peeked ataction - callback that receives the value before the iterator returns itpublic static <T> ObjectIterator<T> peek(java.util.Iterator<? extends T> iterator, java.util.function.Consumer<T> action)
T - the type of elements maintained by this Collectioniterator - that should be peeked ataction - callback that receives the value before the iterator returns itpublic static <T> ObjectIterator<T> wrap(java.util.Iterator<? extends T> iterator)
T - the type of array that the operation should be appliediterator - that should be converted to a unboxing iteratorpublic static <T> speiger.src.collections.objects.utils.ObjectIterators.ArrayIterator<T> wrap(T... a)
T - the type of array that the operation should be applieda - the array that should be wrappedpublic static <T> speiger.src.collections.objects.utils.ObjectIterators.ArrayIterator<T> wrap(T[] a,
int start,
int end)
T - the type of array that the operation should be applieda - the array that should be wrapped.start - the index to be started from.end - the index that should be ended.public static <T> int unwrap(T[] a,
java.util.Iterator<? extends T> i)
T - the type of array that the operation should be applieda - where the elements should be insertedi - the source iteratorpublic static <T> int unwrap(T[] a,
java.util.Iterator<? extends T> i,
int offset)
T - the type of array that the operation should be applieda - where the elements should be insertedi - the source iteratoroffset - the array offset where the start should bepublic static <T> int unwrap(T[] a,
java.util.Iterator<? extends T> i,
int offset,
int max)
T - the type of array that the operation should be applieda - where the elements should be insertedi - the source iteratoroffset - the array offset where the start should bemax - the maximum values that should be extracted from the sourcejava.lang.IllegalStateException - if max is smaller the 0 or if the maximum index is larger then the arraypublic static <T> int unwrap(T[] a,
ObjectIterator<T> i)
T - the type of array that the operation should be applieda - where the elements should be insertedi - the source iteratorpublic static <T> int unwrap(T[] a,
ObjectIterator<T> i,
int offset)
T - the type of array that the operation should be applieda - where the elements should be insertedi - the source iteratoroffset - the array offset where the start should bepublic static <T> int unwrap(T[] a,
ObjectIterator<T> i,
int offset,
int max)
T - the type of array that the operation should be applieda - where the elements should be insertedi - the source iteratoroffset - the array offset where the start should bemax - the maximum values that should be extracted from the sourcejava.lang.IllegalStateException - if max is smaller the 0 or if the maximum index is larger then the arraypublic static <T> ObjectList<T> pour(ObjectIterator<T> iter)
T - the type of array that the operation should be appliediter - the elements that should be poured into list.public static <T> ObjectList<T> pour(ObjectIterator<T> iter, int max)
T - the type of array that the operation should be appliediter - the elements that should be poured into list.max - the maximum amount of elements that should be collectedpublic static <T> int pour(ObjectIterator<T> iter, ObjectCollection<T> c)
T - the type of array that the operation should be appliediter - the elements that should be poured into list.c - the collection where the elements should be poured intopublic static <T> int pour(ObjectIterator<T> iter, ObjectCollection<T> c, int max)
T - the type of array that the operation should be appliediter - the elements that should be poured into list.c - the collection where the elements should be poured intomax - the maximum amount of elements that should be collectedpublic static <T> ObjectIterator<T> concat(ObjectIterator<T>... array)
T - the type of array that the operation should be appliedarray - the Iterators that should be concatenatedpublic static <T> ObjectIterator<T> concat(ObjectIterator<T>[] array, int offset, int length)
T - the type of array that the operation should be appliedarray - the Iterators that should be concatenatedoffset - where to start within the arraylength - the length of the array