public abstract class Zips extends Object
| Constructor and Description |
|---|
Zips() |
| Modifier and Type | Method and Description |
|---|---|
static <CT,ET> Iterator<Pair<CT,ET>> |
counted(ET[] array,
Range<CT> range)
Creates an iterator yielding values from the source iterator and its
index.
|
static <CT,ET> Iterator<Pair<CT,ET>> |
counted(Iterable<ET> iterable,
Range<CT> range)
Creates an iterator yielding values from the source iterator and its
index.
|
static <T> Iterator<Pair<Integer,T>> |
counted(Iterable<T> iterable)
Creates an iterator yielding values from the source iterator and its
index.
|
static <CT,ET> Iterator<Pair<CT,ET>> |
counted(Iterator<ET> iterator,
Range<CT> range)
Creates an iterator yielding values from the source iterator and its
index.
|
static <T> Iterator<Pair<Integer,T>> |
counted(Iterator<T> iterator)
Creates an iterator yielding values from the source iterator and its
index.
|
static <T> Iterator<Pair<Integer,T>> |
counted(T... array)
Creates an iterator yielding values from the source iterator and its
index.
|
static <T1,T2> Iterator<Pair<Maybe<T1>,Maybe<T2>>> |
longest(Iterable<T1> former,
Iterable<T2> latter)
Transforms two iterables to an iterator of tuples, containing
Maybe.just(elements) of both iterables occurring at the same position.
|
static <T1,T2> Iterator<Pair<Maybe<T1>,Maybe<T2>>> |
longest(Iterator<T1> former,
Iterator<T2> latter)
Transforms two iterators to an iterator of tuples, containing
Maybe.just(elements) of both iterators occurring at the same position.
|
static <T1,T2> Iterator<Pair<Maybe<T1>,Maybe<T2>>> |
longest(T1[] former,
T2[] latter)
Transforms two arrays to an iterator of tuples, containing
Maybe.just(elements) of both arrays occurring at the same position.
|
static <T1,T2> Iterator<Pair<T1,T2>> |
shortest(Iterable<T1> former,
Iterable<T2> latter)
Transforms two iterables to an iterator of tuples, containing elements of
both iterables occurring at the same position; the iterator stops when
the shortest input iterable is exhausted.
|
static <T1,T2> Iterator<Pair<T1,T2>> |
shortest(Iterator<T1> former,
Iterator<T2> latter)
Transforms two iterators to an iterator of tuples, containing elements of
both iterators occurring at the same position; the iterator stops when
the shortest input iterable is exhausted.
|
static <T1,T2> Iterator<Pair<T1,T2>> |
shortest(T1[] former,
T2[] latter)
Transforms two arrays to an iterator of tuples, containing elements of
both arrays occurring at the same position; the iterator stops when the
shortest input iterable is exhausted.
|
public static <T1,T2> Iterator<Pair<T1,T2>> shortest(Iterable<T1> former, Iterable<T2> latter)
Zips.shortest([1,2],['a','b','c']) -> [1,'a'], [2,'b']
T1 - former element type parameterT2 - latter element type parameterformer - the former iterablelatter - the latter iterablepublic static <T1,T2> Iterator<Pair<T1,T2>> shortest(Iterator<T1> former, Iterator<T2> latter)
Zips.shortest([1,2],['a','b','c']) -> [1,'a'], [2,'b']
T1 - former element type parameterT2 - latter element type parameterformer - the former iteratorlatter - the latter iteratorpublic static <T1,T2> Iterator<Pair<T1,T2>> shortest(T1[] former, T2[] latter)
Zips.shortest([1,2],['a','b','c']) -> [1,'a'], [2,'b']
T1 - former element type parameterT2 - latter element type parameterformer - the former arraylatter - the latter arraypublic static <T1,T2> Iterator<Pair<Maybe<T1>,Maybe<T2>>> longest(Iterable<T1> former, Iterable<T2> latter)
Zip.longest([1,2],['a','b','c']) -> [(just 1,just 'a'),(just 2 ,just 'b'), (nothing ,just 'c')]
T1 - the former element type parameterT2 - the latter element type parameterformer - the former iterablelatter - the latter iterablepublic static <T1,T2> Iterator<Pair<Maybe<T1>,Maybe<T2>>> longest(Iterator<T1> former, Iterator<T2> latter)
Zip.longest([1,2],['a','b','c']) -> [(just 1,just 'a'),(just 2 ,just 'b'), (nothing ,just 'c')]
T1 - the former element type parameterT2 - the latter element type parameterformer - the former iteratorlatter - the latter iteratorpublic static <T1,T2> Iterator<Pair<Maybe<T1>,Maybe<T2>>> longest(T1[] former, T2[] latter)
Zip.longest([1,2],['a','b','c']) -> [(just 1,just 'a'),(just 2 ,just 'b'), (nothing ,just 'c')]
T1 - the former element type parameterT2 - the latter element type parameterformer - the former arraylatter - the latter arraypublic static <CT,ET> Iterator<Pair<CT,ET>> counted(Iterator<ET> iterator, Range<CT> range)
E.g:
counted(["a", "b","c"], [0..inf]) -> [(0,"a"), (1, "b"), (2, "c")]
CT - the counter typeET - the element typeiterator - the source iteratorrange - the source rangepublic static <T> Iterator<Pair<Integer,T>> counted(Iterator<T> iterator)
E.g:
counted(["a", "b","c"]) -> [(0,"a"), (1, "b"), (2, "c")]
T - the element typeiterator - the source iteratorpublic static <T> Iterator<Pair<Integer,T>> counted(Iterable<T> iterable)
E.g:
counted(["a", "b","c"]) -> [(0,"a"), (1, "b"), (2, "c")]
T - the element typeiterable - the source iterablepublic static <CT,ET> Iterator<Pair<CT,ET>> counted(Iterable<ET> iterable, Range<CT> range)
E.g:
counted(["a", "b","c"], [0..inf]) -> [(0,"a"), (1, "b"), (2, "c")]
CT - the counter typeET - the element typeiterable - the source iterablerange - the source rangepublic static <T> Iterator<Pair<Integer,T>> counted(T... array)
E.g:
counted(["a", "b","c"]) -> [(0,"a"), (1, "b"), (2, "c")]
T - the element typearray - the source arraypublic static <CT,ET> Iterator<Pair<CT,ET>> counted(ET[] array, Range<CT> range)
E.g:
counted(["a", "b","c"], [0..inf]) -> [(0,"a"), (1, "b"), (2, "c")]
CT - the counter typeET - the element typearray - the source arrayrange - the source rangeCopyright © 2016. All rights reserved.