final class TypesImplFolding
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <V,T> V |
foldLeftImpl(java.util.Enumeration<T> enumeration,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do left-associative folding of an enumeration.
|
static <V,T> V |
foldLeftImpl(java.util.Iterator<T> iterator,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do left-associative folding of an iterator.
|
static <V,T> V |
foldRightImpl(java.util.List<T> list,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do right-associative folding of an iteration.
|
static <V,T> V |
foldRightImpl(java.util.ListIterator<T> reverseIterator,
V initialValue,
java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Do right-associative folding of a list iterator using it in reverse direction.
|
public static <V,T> V foldLeftImpl(@NotNull java.util.Iterator<T> iterator, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
See Types.foldLeft(Iterable, Object, BiFunction) for a code example.
V - accumulated value typeT - iterable typeiterator - iterator which elements are folded togetherinitialValue - start valuefolder - folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldLeftImpl(@NotNull java.util.Enumeration<T> enumeration, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
See Types.foldLeft(Iterable, Object, BiFunction) for a code example.
V - accumulated value typeT - iterable typeenumeration - enumeration which elements are folded togetherinitialValue - start valuefolder - folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldRightImpl(@NotNull java.util.List<T> list, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
V - accumulated value typeT - iterator typelist - list which elements are folded togetherinitialValue - start valuefolder - folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combinationpublic static <V,T> V foldRightImpl(@NotNull java.util.ListIterator<T> reverseIterator, V initialValue, @NotNull java.util.function.BiFunction<? super V,? super T,? extends V> folder)
Folding is the reduction of the elements of a collection into one value, by applying the same function on each element with the result of the last call.
V - accumulated value typeT - list typereverseIterator - iterator which is traverse in reverse directioninitialValue - start valuefolder - folding function, the apply method gets the accumulated value
as its first and the element as its second argument,
and returns the result of their combination