@FunctionalInterface public interface BiSequence<L,R> extends IterableList<Pair<L,R>>
| Modifier and Type | Method and Description |
|---|---|
default boolean |
all(java.util.function.BiPredicate<? super L,? super R> biPredicate) |
default boolean |
any(java.util.function.BiPredicate<? super L,? super R> biPredicate) |
default BiSequence<L,R> |
append(java.lang.Iterable<? extends Pair<L,R>> that)
Append the elements of the given
Iterable to the end of this BiSequence. |
default BiSequence<L,R> |
append(java.util.Iterator<? extends Pair<L,R>> iterator)
Append the elements of the given
Iterator to the end of this BiSequence. |
default BiSequence<L,R> |
append(Pair<L,R>... entries)
Append the given elements to the end of this
BiSequence. |
default BiSequence<L,R> |
append(java.util.stream.Stream<Pair<L,R>> stream)
Append the elements of the given
Stream to the end of this BiSequence. |
default BiSequence<L,R> |
appendPair(L left,
R right)
Append the given pair to the end of this
BiSequence. |
default java.util.Optional<Pair<L,R>> |
at(int index) |
default java.util.Optional<Pair<L,R>> |
at(int index,
java.util.function.BiPredicate<? super L,? super R> predicate) |
default java.util.Optional<Pair<L,R>> |
at(int index,
java.util.function.Predicate<? super Pair<L,R>> predicate) |
default Sequence<BiSequence<L,R>> |
batch(java.util.function.BiPredicate<? super Pair<L,R>,? super Pair<L,R>> predicate)
Batch the elements of this
BiSequence into a sequence of BiSequences of distinct elements, where
the given predicate determines where to split the lists of partitioned elements. |
default Sequence<BiSequence<L,R>> |
batch(int size)
Batch the elements of this
BiSequence into a sequence of BiSequences of distinct elements, each
with the given batch size. |
default Sequence<BiSequence<L,R>> |
batch(QuaternaryPredicate<? super L,? super R,? super L,? super R> predicate)
Batch the elements of this
BiSequence into a sequence of BiSequences of distinct elements,
where the given predicate determines where to split the lists of partitioned elements. |
static <L,R> BiSequence<L,R> |
cache(java.lang.Iterable<Pair<L,R>> iterable)
Create a
BiSequence with a cached copy of an Iterable of pairs. |
static <L,R> BiSequence<L,R> |
cache(java.util.Iterator<Pair<L,R>> iterator)
Create a
BiSequence with a cached copy of an Iterator of pairs. |
static <L,R> BiSequence<L,R> |
cache(java.util.stream.Stream<Pair<L,R>> stream)
Create a
BiSequence with a cached copy of a Stream of pairs. |
default <S,C> S |
collect(java.util.stream.Collector<Pair<L,R>,C,S> collector)
Collect this
BiSequence into an arbitrary container using the given Collector. |
default <C> C |
collect(java.util.function.Supplier<? extends C> constructor,
java.util.function.BiConsumer<? super C,? super Pair<L,R>> adder)
Collect this
BiSequence into an arbitrary container using the given constructor and adder. |
default <C> C |
collectInto(C result,
java.util.function.BiConsumer<? super C,? super Pair<L,R>> adder)
Collect this
Sequence into the given container, using the given adder. |
default <U extends java.util.Collection<Pair<L,R>>> |
collectInto(U collection)
Collect this
BiSequence into the given Collection. |
default boolean |
contains(L left,
R right) |
default boolean |
contains(Pair<L,R> pair) |
default boolean |
containsAll(java.lang.Iterable<? extends Pair<L,R>> pairs) |
default boolean |
containsAll(Pair<L,R>... pairs) |
default boolean |
containsAny(java.lang.Iterable<? extends Pair<L,R>> pairs) |
default boolean |
containsAny(Pair<L,R>... pairs) |
default BiSequence<L,R> |
distinct() |
static <L,R> BiSequence<L,R> |
empty()
Create an empty
BiSequence with no items. |
default BiSequence<L,R> |
endingAt(java.util.function.BiPredicate<? super L,? super R> terminal)
Terminate this
BiSequence when the given predicate is satisfied, including the element that satisfies
the predicate as the last element in the BiSequence. |
default BiSequence<L,R> |
endingAt(L left,
R right)
Terminate this
BiSequence when the pair with the given left and right components is encountered,
including the element as the last element in the BiSequence. |
default BiSequence<L,R> |
endingAt(Pair<L,R> terminal)
Terminate this
BiSequence when the given element is encountered, including the element as the last
element in the BiSequence. |
default BiSequence<L,R> |
endingAt(java.util.function.Predicate<? super Pair<L,R>> terminal)
Terminate this
BiSequence when the given predicate is satisfied, including the element that satisfies
the predicate as the last element in the BiSequence. |
default BiSequence<L,R> |
excluding(java.lang.Iterable<? extends Pair<L,R>> pairs) |
default BiSequence<L,R> |
excluding(Pair<L,R>... pairs) |
default BiSequence<L,R> |
filter(java.util.function.BiPredicate<? super L,? super R> predicate)
Filter the elements in this
BiSequence, keeping only the elements that match the given
BiPredicate. |
default BiSequence<L,R> |
filter(java.util.function.Predicate<? super Pair<L,R>> predicate)
Filter the elements in this
BiSequence, keeping only the pairs that match the given
Predicate. |
default BiSequence<L,R> |
filterIndexed(ObjIntPredicate<? super Pair<L,R>> predicate)
Filter the pairs in this
BiSequence, keeping only the elements that match the given
ObjIntPredicate, which is passed the current pair and its index in the sequence. |
default BiSequence<L,R> |
filterIndexed(ObjObjIntPredicate<? super L,? super R> predicate)
Filter the pairs in this
BiSequence, keeping only the elements that match the given
ObjObjIntPredicate, which is passed the current pair and its index in the sequence. |
default java.util.Optional<Pair<L,R>> |
first() |
default java.util.Optional<Pair<L,R>> |
first(java.util.function.BiPredicate<? super L,? super R> predicate) |
default java.util.Optional<Pair<L,R>> |
first(java.util.function.Predicate<? super Pair<L,R>> predicate) |
default <T> Sequence<T> |
flatten() |
default <LL,RR> BiSequence<LL,RR> |
flatten(java.util.function.BiFunction<? super L,? super R,? extends java.lang.Iterable<Pair<LL,RR>>> mapper)
Flatten the elements in this
BiSequence according to the given mapper BiFunction. |
default <LL,RR> BiSequence<LL,RR> |
flatten(java.util.function.Function<? super Pair<L,R>,? extends java.lang.Iterable<Pair<LL,RR>>> function)
Flatten the elements in this
BiSequence according to the given mapper Function. |
default <LL> BiSequence<LL,R> |
flattenLeft(java.util.function.Function<? super Pair<L,R>,? extends java.lang.Iterable<LL>> mapper)
Flatten the left side of each pair in this sequence, applying multiples of left values returned by the given
mapper to the same right value of each pair.
|
default <RR> BiSequence<L,RR> |
flattenRight(java.util.function.Function<? super Pair<L,R>,? extends java.lang.Iterable<RR>> mapper)
Flatten the right side of each pair in this sequence, applying multiples of right values returned by the given
mapper to the same left value of each pair.
|
default void |
forEach(java.util.function.BiConsumer<? super L,? super R> action)
Perform the given action for each element in this
BiSequence. |
static <L,R> BiSequence<L,R> |
from(java.lang.Iterable<Pair<L,R>>... iterables)
Create a concatenated
BiSequence from several Iterables of pairs which are concatenated together
to form the stream of pairs in the BiSequence. |
static <L,R> BiSequence<L,R> |
from(java.lang.Iterable<Pair<L,R>> iterable)
Create a
BiSequence from an Iterable of pairs. |
static <K,V> BiSequence<K,V> |
from(java.util.Map<K,V> map)
Create a
BiSequence of Map.Entry key/value items from a Map of items. |
static <L,R> BiSequence<L,R> |
generate(java.util.function.Supplier<Pair<L,R>> supplier) |
default BiSequence<L,R> |
including(java.lang.Iterable<? extends Pair<L,R>> pairs) |
default BiSequence<L,R> |
including(Pair<L,R>... pairs) |
default java.lang.String |
join(java.lang.String delimiter)
Join this
BiSequence into a string separated by the given delimiter. |
default java.lang.String |
join(java.lang.String prefix,
java.lang.String delimiter,
java.lang.String suffix)
Join this
BiSequence into a string separated by the given delimiter, with the given prefix and suffix. |
default java.util.Optional<Pair<L,R>> |
last() |
default java.util.Optional<Pair<L,R>> |
last(java.util.function.BiPredicate<? super L,? super R> predicate) |
default java.util.Optional<Pair<L,R>> |
last(java.util.function.Predicate<? super Pair<L,R>> predicate) |
default BiSequence<L,R> |
limit(int limit)
Limit the maximum number of results returned by this
BiSequence. |
default <LL,RR> BiSequence<LL,RR> |
map(java.util.function.BiFunction<? super L,? super R,? extends Pair<LL,RR>> mapper)
Map the pairs in this
BiSequence to another set of pairs specified by the given mapper
function. |
default <LL,RR> BiSequence<LL,RR> |
map(java.util.function.Function<? super L,? extends LL> leftMapper,
java.util.function.Function<? super R,? extends RR> rightMapper)
Map the pairs in this
BiSequence to another set of pairs specified by the given leftMapper
amd rightMapper functions. |
default <LL,RR> BiSequence<LL,RR> |
map(java.util.function.Function<? super Pair<L,R>,? extends Pair<LL,RR>> mapper)
Map the pairs in this
BiSequence to another set of pairs specified by the given mapper
function. |
default <LL,RR> BiSequence<LL,RR> |
mapIndexed(ObjIntFunction<? super Pair<L,R>,? extends Pair<LL,RR>> mapper)
Map the pairs in this
BiSequence to another set of pairs specified by the given mapper function. |
default <LL,RR> BiSequence<LL,RR> |
mapIndexed(ObjObjIntFunction<? super L,? super R,? extends Pair<LL,RR>> mapper)
Map the pairs in this
BiSequence to another set of pairs specified by the given mapper function. |
default java.util.Optional<Pair<L,R>> |
max() |
default java.util.Optional<Pair<L,R>> |
max(java.util.Comparator<? super Pair<L,R>> comparator) |
default java.util.Optional<Pair<L,R>> |
min() |
default java.util.Optional<Pair<L,R>> |
min(java.util.Comparator<? super Pair<L,R>> comparator) |
static <L,R> BiSequence<L,R> |
multiGenerate(java.util.function.Supplier<? extends java.util.function.Supplier<? extends Pair<L,R>>> supplierSupplier) |
default boolean |
none(java.util.function.BiPredicate<? super L,? super R> predicate) |
static <L,R> BiSequence<L,R> |
of(Pair<L,R>... items)
Create a
BiSequence with the given Pairs. |
static <L,R> BiSequence<L,R> |
of(Pair<L,R> item)
Create a
BiSequence with one Pair. |
static <L,R> BiSequence<L,R> |
ofPair(L left,
R right)
Create a
BiSequence with one Pair of the given left and right values. |
static <T,U> BiSequence<T,U> |
ofPairs(java.lang.Object... os)
Create a
BiSequence with Pairs of the given left and right values given in sequence in the input
array. |
static <L,R> BiSequence<L,R> |
once(java.util.Iterator<Pair<L,R>> iterator)
Create a once-only
BiSequence from an Iterator of pairs. |
static <L,R> BiSequence<L,R> |
once(java.util.stream.Stream<Pair<L,R>> stream)
Create a once-only
BiSequence from a Stream of pairs. |
default BiSequence<L,R> |
peek(java.util.function.BiConsumer<? super L,? super R> action)
Allow the given
BiConsumer to see the components of each pair in this BiSequence as it is
traversed. |
default BiSequence<L,R> |
peek(java.util.function.Consumer<? super Pair<L,R>> consumer)
Allow the given
Consumer to see each pair in this BiSequence as it is traversed. |
default BiSequence<L,R> |
peekIndexed(java.util.function.ObjIntConsumer<? super Pair<L,R>> action)
Allow the given
ObjLongConsumer to see each pair with its index as this BiSequence is
traversed. |
default BiSequence<L,R> |
peekIndexed(ObjObjIntConsumer<? super L,? super R> action)
Allow the given
ObjObjIntConsumer to see the components of each pair with their index as this
BiSequence is traversed. |
static <L,R,LL,RR> |
recurse(L leftSeed,
R rightSeed,
java.util.function.BiFunction<? super L,? super R,? extends Pair<LL,RR>> f,
java.util.function.BiFunction<? super LL,? super RR,? extends Pair<L,R>> g)
Returns a
BiSequence produced by recursively applying the given mapper f and incrementer
g operations to the given seeds, the first element being f(leftSeed, rightSeed), the second
being f(g(f(leftSeed, rightSeed))), the third f(g(f(g(f(leftSeed, rightSeed))))) and so on. |
static <L,R> BiSequence<L,R> |
recurse(L leftSeed,
R rightSeed,
java.util.function.BiFunction<? super L,? super R,? extends Pair<L,R>> op)
Returns a
BiSequence produced by recursively applying the given operation to the given seeds, which
form the first element of the sequence, the second being f(leftSeed, rightSeed), the third
f(f(leftSeed, rightSeed)) and so on. |
static <L,R> BiSequence<L,R> |
recurse(Pair<L,R> seed,
java.util.function.UnaryOperator<Pair<L,R>> op)
Returns a
BiSequence produced by recursively applying the given operation to the given seed, which
form the first element of the sequence, the second being f(seed), the third f(f(seed)) and so
on. |
default java.util.Optional<Pair<L,R>> |
reduce(java.util.function.BinaryOperator<Pair<L,R>> operator)
Reduce this
BiSequence into a single element by iteratively applying the given binary operator to
the current result and each pair in this sequence. |
default Pair<L,R> |
reduce(L left,
R right,
QuaternaryFunction<L,R,L,R,Pair<L,R>> operator)
Reduce this
BiSequence into a single element by iteratively applying the given binary operator to
the current result and each entry in this sequence, starting with the given identity as the initial result. |
default Pair<L,R> |
reduce(Pair<L,R> identity,
java.util.function.BinaryOperator<Pair<L,R>> operator)
Reduce this
BiSequence into a single element by iteratively applying the given binary operator to
the current result and each pair in this sequence, starting with the given identity as the initial result. |
default java.util.Optional<Pair<L,R>> |
reduce(QuaternaryFunction<L,R,L,R,Pair<L,R>> operator)
Reduce this
BiSequence into a single element by iteratively applying the given function to
the current result and each element in this sequence. |
default BiSequence<L,R> |
repeat()
Repeat this
BiSequence forever, producing a sequence that never terminates unless the original sequence
is empty in which case the resulting sequence is also empty. |
default BiSequence<L,R> |
repeat(int times)
Repeat this
BiSequence the given number of times. |
default BiSequence<L,R> |
reverse() |
default BiSequence<L,R> |
shuffle() |
default BiSequence<L,R> |
shuffle(java.util.Random random) |
default BiSequence<L,R> |
shuffle(java.util.function.Supplier<? extends java.util.Random> randomSupplier) |
default BiSequence<L,R> |
skip(int skip)
Skip a set number of steps in this
BiSequence. |
default BiSequence<L,R> |
skipTail(int skip)
Skip a set number of steps at the end of this
BiSequence. |
default BiSequence<L,R> |
sorted() |
default BiSequence<L,R> |
sorted(java.util.Comparator<? super Pair<? extends L,? extends R>> comparator) |
default Sequence<BiSequence<L,R>> |
split(java.util.function.BiPredicate<? super L,? super R> predicate)
Split the elements of this
BiSequence into a sequence of BiSequences of distinct elements,
where the given predicate determines which elements to split the partitioned elements around. |
default Sequence<BiSequence<L,R>> |
split(Pair<L,R> element)
Split the elements of this
BiSequence into a sequence of BiSequences of distinct elements,
around the given element. |
default Sequence<BiSequence<L,R>> |
split(java.util.function.Predicate<? super Pair<L,R>> predicate)
Split the elements of this
BiSequence into a sequence of BiSequences of distinct elements,
where the given predicate determines which elements to split the partitioned elements around. |
default BiSequence<L,R> |
startingAfter(java.util.function.BiPredicate<? super L,? super R> predicate)
Begin this
BiSequence just after the given predicate is satisfied, not including the pair that
satisfies the predicate in the BiSequence. |
default BiSequence<L,R> |
startingAfter(Pair<L,R> element)
Begin this
BiSequence just after the given pair is encountered, not including the pair in the
BiSequence. |
default BiSequence<L,R> |
startingAfter(java.util.function.Predicate<? super Pair<L,R>> predicate)
Begin this
BiSequence just after the given predicate is satisfied, not including the pair that
satisfies the predicate in the BiSequence. |
default BiSequence<L,R> |
startingFrom(java.util.function.BiPredicate<? super L,? super R> predicate)
Begin this
BiSequence when the given predicate is satisfied, including the pair that satisfies
the predicate as the first element in the BiSequence. |
default BiSequence<L,R> |
startingFrom(Pair<L,R> element)
Begin this
BiSequence when the given pair is encountered, including the pair as the first element
in the BiSequence. |
default BiSequence<L,R> |
startingFrom(java.util.function.Predicate<? super Pair<L,R>> predicate)
Begin this
BiSequence when the given predicate is satisfied, including the pair that satisfies
the predicate as the first element in the BiSequence. |
default BiSequence<L,R> |
step(int step)
Skip x number of steps in between each invocation of the iterator of this
BiSequence. |
default Pair<L,R>[] |
toArray()
Collect the pairs in this
BiSequence into an array. |
default Pair<L,R>[] |
toArray(java.util.function.IntFunction<Pair<L,R>[]> constructor)
Collect the pairs in this
BiSequence into an array of the type determined by the given array
constructor. |
default CharSeq |
toChars(ToCharBiFunction<? super L,? super R> mapper)
|
default CharSeq |
toChars(ToCharFunction<? super Pair<L,R>> mapper)
|
default <C extends java.util.Collection<Pair<L,R>>> |
toCollection(java.util.function.Supplier<? extends C> constructor)
Collect this
BiSequence into a Collection of the type determined by the given constructor. |
default DoubleSequence |
toDoubles(java.util.function.ToDoubleBiFunction<? super L,? super R> mapper)
Convert this
BiSequence to a DoubleSequence using the given mapper function to map each pair
to a double. |
default DoubleSequence |
toDoubles(java.util.function.ToDoubleFunction<? super Pair<L,R>> mapper)
Convert this
BiSequence to a DoubleSequence using the given mapper function to map each pair
to a double. |
default EntrySequence<L,R> |
toEntrySequence()
|
default IntSequence |
toInts(java.util.function.ToIntBiFunction<? super L,? super R> mapper)
Convert this
BiSequence to an IntSequence using the given mapper function to map each pair
to an int. |
default IntSequence |
toInts(java.util.function.ToIntFunction<? super Pair<L,R>> mapper)
Convert this
BiSequence to an IntSequence using the given mapper function to map each pair
to an int. |
default java.util.List<Pair<L,R>> |
toList()
Collect the pairs in this
BiSequence into a List. |
default java.util.List<Pair<L,R>> |
toList(java.util.function.Supplier<java.util.List<Pair<L,R>>> constructor)
Collect the pairs in this
BiSequence into a List of the type determined by the given
constructor. |
default LongSequence |
toLongs(java.util.function.ToLongBiFunction<? super L,? super R> mapper)
Convert this
BiSequence to a LongSequence using the given mapper function to map each pair to a
long. |
default LongSequence |
toLongs(java.util.function.ToLongFunction<? super Pair<L,R>> mapper)
Convert this
BiSequence to a LongSequence using the given mapper function to map each pair to a
long. |
default java.util.Map<L,R> |
toMap()
Collect the pairs in this
BiSequence into a Map. |
default <M extends java.util.Map<L,R>> |
toMap(java.util.function.Supplier<? extends M> constructor)
Collect the pairs in this
BiSequence into a Map of the type determined by the given
constructor. |
default Sequence<Pair<L,R>> |
toSequence()
|
default <T> Sequence<T> |
toSequence(java.util.function.BiFunction<? super L,? super R,? extends T> mapper)
Convert this
BiSequence to a Sequence where each item is generated by the given mapper. |
default <T> Sequence<T> |
toSequence(java.util.function.Function<? super Pair<L,R>,? extends T> mapper)
Convert this
BiSequence to a Sequence where each item is generated by the given mapper. |
default java.util.Set<Pair<L,R>> |
toSet()
Collect the pairs in this
BiSequence into a Set. |
default <S extends java.util.Set<Pair<L,R>>> |
toSet(java.util.function.Supplier<? extends S> constructor)
Collect the pairs in this
BiSequence into a Set of the type determined by the given
constructor. |
default java.util.SortedMap<L,R> |
toSortedMap()
Collect the pairs in this
BiSequence into a SortedMap. |
default java.util.SortedSet<Pair<L,R>> |
toSortedSet()
Collect the pairs in this
BiSequence into a SortedSet. |
default BiSequence<L,R> |
until(java.util.function.BiPredicate<? super L,? super R> terminal)
Terminate this
BiSequence just before the given predicate is satisfied, not including the element that
satisfies the predicate in the BiSequence. |
default BiSequence<L,R> |
until(L left,
R right)
Terminate this
BiSequence just before the pair with the given left and right components is encountered,
not including the pair in the BiSequence. |
default BiSequence<L,R> |
until(Pair<L,R> terminal)
Terminate this
BiSequence just before the given element is encountered, not including the element in the
BiSequence. |
default BiSequence<L,R> |
until(java.util.function.Predicate<? super Pair<L,R>> terminal)
Terminate this
BiSequence just before the given predicate is satisfied, not including the element that
satisfies the predicate in the BiSequence. |
default Sequence<BiSequence<L,R>> |
window(int window)
Window the elements of this
BiSequence into a Sequence of BiSequences of pairs, each
with the size of the given window. |
default Sequence<BiSequence<L,R>> |
window(int window,
int step)
Window the elements of this
BiSequence into a sequence of BiSequences of elements, each with the
size of the given window, stepping step elements between each window. |
add, add, addAll, addAll, clear, contains, containsAll, from, get, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArraystatic <L,R> BiSequence<L,R> empty()
BiSequence with no items.empty in interface IterableCollection<Pair<L,R>>of(Pair),
of(Pair...),
ofPair(Object, Object),
ofPairs(Object...),
from(Iterable)static <L,R> BiSequence<L,R> of(Pair<L,R> item)
BiSequence with one Pair.of in interface IterableCollection<Pair<L,R>>of(Pair...),
ofPair(Object, Object),
ofPairs(Object...),
from(Iterable)@SafeVarargs static <L,R> BiSequence<L,R> of(Pair<L,R>... items)
BiSequence with the given Pairs.of in interface IterableCollection<Pair<L,R>>of(Pair),
ofPair(Object, Object),
ofPairs(Object...),
from(Iterable)static <L,R> BiSequence<L,R> ofPair(L left, R right)
BiSequence with one Pair of the given left and right values.ofPairs(Object...),
of(Pair),
of(Pair...),
from(Iterable)static <T,U> BiSequence<T,U> ofPairs(java.lang.Object... os)
BiSequence with Pairs of the given left and right values given in sequence in the input
array.java.lang.IllegalArgumentException - if the array of left and right values is not of even length.ofPair(Object, Object),
of(Pair),
of(Pair...),
from(Iterable)static <L,R> BiSequence<L,R> from(java.lang.Iterable<Pair<L,R>> iterable)
BiSequence from an Iterable of pairs.of(Pair),
of(Pair...),
from(Iterable...),
cache(Iterable)@SafeVarargs static <L,R> BiSequence<L,R> from(java.lang.Iterable<Pair<L,R>>... iterables)
BiSequence from several Iterables of pairs which are concatenated together
to form the stream of pairs in the BiSequence.of(Pair),
of(Pair...),
from(Iterable)static <L,R> BiSequence<L,R> once(java.util.Iterator<Pair<L,R>> iterator)
BiSequence from an Iterator of pairs. Note that BiSequences created
from Iterators cannot be passed over more than once. Further attempts will register the
BiSequence as empty.of(Pair),
of(Pair...),
from(Iterable),
cache(Iterator)static <L,R> BiSequence<L,R> once(java.util.stream.Stream<Pair<L,R>> stream)
BiSequence from a Stream of pairs. Note that BiSequences created from
Streams cannot be passed over more than once. Further attempts will register the BiSequence as
empty.of(Pair),
of(Pair...),
from(Iterable),
once(Iterator),
cache(Stream)static <K,V> BiSequence<K,V> from(java.util.Map<K,V> map)
BiSequence of Map.Entry key/value items from a Map of items. The resulting
BiSequence can be mapped using Pair items, which implement Map.Entry and can thus be
processed as part of the BiSequence's transformation steps.of(org.d2ab.util.Pair<L, R>),
from(Iterable)static <L,R> BiSequence<L,R> cache(java.lang.Iterable<Pair<L,R>> iterable)
BiSequence with a cached copy of an Iterable of pairs.cache(Iterator),
cache(Stream),
from(Iterable)static <L,R> BiSequence<L,R> cache(java.util.Iterator<Pair<L,R>> iterator)
BiSequence with a cached copy of an Iterator of pairs.cache(Iterable),
cache(Stream),
once(Iterator)static <L,R> BiSequence<L,R> cache(java.util.stream.Stream<Pair<L,R>> stream)
BiSequence with a cached copy of a Stream of pairs.cache(Iterable),
cache(Iterator),
once(Stream)static <L,R> BiSequence<L,R> generate(java.util.function.Supplier<Pair<L,R>> supplier)
BiSequence generated by repeatedly calling the given supplier. The returned
BiSequence never terminates naturally.recurse(Pair, UnaryOperator),
endingAt(Pair),
until(Pair)static <L,R> BiSequence<L,R> multiGenerate(java.util.function.Supplier<? extends java.util.function.Supplier<? extends Pair<L,R>>> supplierSupplier)
BiSequence where each Collection.iterator() is generated by polling for a supplier and
then using it to generate the sequence of pairs. The sequence never terminates.generate(Supplier),
recurse(Pair, UnaryOperator),
endingAt(Pair),
until(Pair)static <L,R> BiSequence<L,R> recurse(L leftSeed, R rightSeed, java.util.function.BiFunction<? super L,? super R,? extends Pair<L,R>> op)
BiSequence produced by recursively applying the given operation to the given seeds, which
form the first element of the sequence, the second being f(leftSeed, rightSeed), the third
f(f(leftSeed, rightSeed)) and so on. The returned BiSequence never terminates naturally.BiSequence produced by recursively applying the given operation to the given seedrecurse(Pair, UnaryOperator),
generate(Supplier),
endingAt(Pair),
until(Pair)static <L,R> BiSequence<L,R> recurse(Pair<L,R> seed, java.util.function.UnaryOperator<Pair<L,R>> op)
BiSequence produced by recursively applying the given operation to the given seed, which
form the first element of the sequence, the second being f(seed), the third f(f(seed)) and so
on. The returned BiSequence never terminates naturally.BiSequence produced by recursively applying the given operation to the given seedrecurse(Pair, UnaryOperator),
generate(Supplier),
endingAt(Pair),
until(Pair)static <L,R,LL,RR> BiSequence<LL,RR> recurse(L leftSeed, R rightSeed, java.util.function.BiFunction<? super L,? super R,? extends Pair<LL,RR>> f, java.util.function.BiFunction<? super LL,? super RR,? extends Pair<L,R>> g)
BiSequence produced by recursively applying the given mapper f and incrementer
g operations to the given seeds, the first element being f(leftSeed, rightSeed), the second
being f(g(f(leftSeed, rightSeed))), the third f(g(f(g(f(leftSeed, rightSeed))))) and so on.
The returned BiSequence never terminates naturally.f - a mapper function for producing elements that are to be included in the sequence, the first being
f(leftSeed, rightSeed)g - an incrementer function for producing the next unmapped element to be included in the sequence,
applied to the first mapped element f(leftSeed, rightSeed) to produce the second unmapped valueBiSequence produced by recursively applying the given mapper and incrementer operations to the
given seedsrecurse(Pair, UnaryOperator),
endingAt(Pair),
until(Pair)default <LL,RR> BiSequence<LL,RR> map(java.util.function.BiFunction<? super L,? super R,? extends Pair<LL,RR>> mapper)
BiSequence to another set of pairs specified by the given mapper
function.map(Function),
map(Function, Function),
flatten(Function)default <LL,RR> BiSequence<LL,RR> map(java.util.function.Function<? super Pair<L,R>,? extends Pair<LL,RR>> mapper)
BiSequence to another set of pairs specified by the given mapper
function.map(BiFunction),
map(Function, Function),
flatten(Function)default <LL,RR> BiSequence<LL,RR> map(java.util.function.Function<? super L,? extends LL> leftMapper, java.util.function.Function<? super R,? extends RR> rightMapper)
BiSequence to another set of pairs specified by the given leftMapper
amd rightMapper functions.map(BiFunction),
map(Function),
flatten(Function)default <LL,RR> BiSequence<LL,RR> mapIndexed(ObjIntFunction<? super Pair<L,R>,? extends Pair<LL,RR>> mapper)
BiSequence to another set of pairs specified by the given mapper function.
In addition to the current pair, the mapper has access to the index of each pair.map(Function),
flatten(Function)default <LL,RR> BiSequence<LL,RR> mapIndexed(ObjObjIntFunction<? super L,? super R,? extends Pair<LL,RR>> mapper)
BiSequence to another set of pairs specified by the given mapper function.
In addition to the current pair, the mapper has access to the index of each pair.map(Function),
flatten(Function)default BiSequence<L,R> skip(int skip)
BiSequence.default BiSequence<L,R> skipTail(int skip)
BiSequence.default BiSequence<L,R> limit(int limit)
BiSequence.default BiSequence<L,R> filter(java.util.function.BiPredicate<? super L,? super R> predicate)
BiSequence, keeping only the elements that match the given
BiPredicate.default BiSequence<L,R> filter(java.util.function.Predicate<? super Pair<L,R>> predicate)
BiSequence, keeping only the pairs that match the given
Predicate.default BiSequence<L,R> filterIndexed(ObjIntPredicate<? super Pair<L,R>> predicate)
BiSequence, keeping only the elements that match the given
ObjIntPredicate, which is passed the current pair and its index in the sequence.default BiSequence<L,R> filterIndexed(ObjObjIntPredicate<? super L,? super R> predicate)
BiSequence, keeping only the elements that match the given
ObjObjIntPredicate, which is passed the current pair and its index in the sequence.default BiSequence<L,R> including(Pair<L,R>... pairs)
BiSequence containing only the pairs found in the given target array.default BiSequence<L,R> including(java.lang.Iterable<? extends Pair<L,R>> pairs)
BiSequence containing only the pairs found in the given target iterable.default BiSequence<L,R> excluding(Pair<L,R>... pairs)
BiSequence containing only the pairs not found in the given target array.default BiSequence<L,R> excluding(java.lang.Iterable<? extends Pair<L,R>> pairs)
BiSequence containing only the pairs not found in the given target iterable.default <T> Sequence<T> flatten()
default <LL,RR> BiSequence<LL,RR> flatten(java.util.function.BiFunction<? super L,? super R,? extends java.lang.Iterable<Pair<LL,RR>>> mapper)
BiSequence according to the given mapper BiFunction. The resulting
BiSequence contains the elements that is the result of applying the mapper BiFunction to each
element, appended together inline as a single BiSequence.default <LL,RR> BiSequence<LL,RR> flatten(java.util.function.Function<? super Pair<L,R>,? extends java.lang.Iterable<Pair<LL,RR>>> function)
BiSequence according to the given mapper Function. The resulting
BiSequence contains the pairs that is the result of applying the mapper Function to each
pair, appended together inline as a single BiSequence.default <LL> BiSequence<LL,R> flattenLeft(java.util.function.Function<? super Pair<L,R>,? extends java.lang.Iterable<LL>> mapper)
default <RR> BiSequence<L,RR> flattenRight(java.util.function.Function<? super Pair<L,R>,? extends java.lang.Iterable<RR>> mapper)
default BiSequence<L,R> until(Pair<L,R> terminal)
BiSequence just before the given element is encountered, not including the element in the
BiSequence.default BiSequence<L,R> endingAt(Pair<L,R> terminal)
BiSequence when the given element is encountered, including the element as the last
element in the BiSequence.default BiSequence<L,R> until(L left, R right)
BiSequence just before the pair with the given left and right components is encountered,
not including the pair in the BiSequence.default BiSequence<L,R> endingAt(L left, R right)
BiSequence when the pair with the given left and right components is encountered,
including the element as the last element in the BiSequence.default BiSequence<L,R> until(java.util.function.BiPredicate<? super L,? super R> terminal)
BiSequence just before the given predicate is satisfied, not including the element that
satisfies the predicate in the BiSequence.default BiSequence<L,R> endingAt(java.util.function.BiPredicate<? super L,? super R> terminal)
BiSequence when the given predicate is satisfied, including the element that satisfies
the predicate as the last element in the BiSequence.default BiSequence<L,R> until(java.util.function.Predicate<? super Pair<L,R>> terminal)
BiSequence just before the given predicate is satisfied, not including the element that
satisfies the predicate in the BiSequence.default BiSequence<L,R> endingAt(java.util.function.Predicate<? super Pair<L,R>> terminal)
BiSequence when the given predicate is satisfied, including the element that satisfies
the predicate as the last element in the BiSequence.default BiSequence<L,R> startingAfter(Pair<L,R> element)
BiSequence just after the given pair is encountered, not including the pair in the
BiSequence.startingAfter(Predicate),
startingAfter(BiPredicate),
startingFrom(Pair)default BiSequence<L,R> startingFrom(Pair<L,R> element)
BiSequence when the given pair is encountered, including the pair as the first element
in the BiSequence.startingFrom(Predicate),
startingFrom(BiPredicate),
startingAfter(Pair)default BiSequence<L,R> startingAfter(java.util.function.Predicate<? super Pair<L,R>> predicate)
BiSequence just after the given predicate is satisfied, not including the pair that
satisfies the predicate in the BiSequence.startingAfter(BiPredicate),
startingAfter(Pair),
startingFrom(Predicate)default BiSequence<L,R> startingFrom(java.util.function.Predicate<? super Pair<L,R>> predicate)
BiSequence when the given predicate is satisfied, including the pair that satisfies
the predicate as the first element in the BiSequence.startingFrom(BiPredicate),
startingFrom(Pair),
startingAfter(Predicate)default BiSequence<L,R> startingAfter(java.util.function.BiPredicate<? super L,? super R> predicate)
BiSequence just after the given predicate is satisfied, not including the pair that
satisfies the predicate in the BiSequence.startingAfter(Predicate),
startingAfter(Pair),
startingFrom(Predicate)default BiSequence<L,R> startingFrom(java.util.function.BiPredicate<? super L,? super R> predicate)
BiSequence when the given predicate is satisfied, including the pair that satisfies
the predicate as the first element in the BiSequence.startingFrom(Predicate),
startingFrom(Pair),
startingAfter(Predicate)default Pair<L,R>[] toArray(java.util.function.IntFunction<Pair<L,R>[]> constructor)
BiSequence into an array of the type determined by the given array
constructor.default java.util.List<Pair<L,R>> toList(java.util.function.Supplier<java.util.List<Pair<L,R>>> constructor)
BiSequence into a List of the type determined by the given
constructor.default <S extends java.util.Set<Pair<L,R>>> S toSet(java.util.function.Supplier<? extends S> constructor)
BiSequence into a Set of the type determined by the given
constructor.default java.util.SortedSet<Pair<L,R>> toSortedSet()
BiSequence into a SortedSet.default <M extends java.util.Map<L,R>> M toMap(java.util.function.Supplier<? extends M> constructor)
BiSequence into a Map of the type determined by the given
constructor.default java.util.SortedMap<L,R> toSortedMap()
BiSequence into a SortedMap.default <C extends java.util.Collection<Pair<L,R>>> C toCollection(java.util.function.Supplier<? extends C> constructor)
BiSequence into a Collection of the type determined by the given constructor.default <C> C collect(java.util.function.Supplier<? extends C> constructor,
java.util.function.BiConsumer<? super C,? super Pair<L,R>> adder)
BiSequence into an arbitrary container using the given constructor and adder.default <S,C> S collect(java.util.stream.Collector<Pair<L,R>,C,S> collector)
BiSequence into an arbitrary container using the given Collector.default <U extends java.util.Collection<Pair<L,R>>> U collectInto(U collection)
BiSequence into the given Collection.default <C> C collectInto(C result,
java.util.function.BiConsumer<? super C,? super Pair<L,R>> adder)
Sequence into the given container, using the given adder.default java.lang.String join(java.lang.String delimiter)
BiSequence into a string separated by the given delimiter.default java.lang.String join(java.lang.String prefix,
java.lang.String delimiter,
java.lang.String suffix)
BiSequence into a string separated by the given delimiter, with the given prefix and suffix.default java.util.Optional<Pair<L,R>> reduce(java.util.function.BinaryOperator<Pair<L,R>> operator)
BiSequence into a single element by iteratively applying the given binary operator to
the current result and each pair in this sequence.default java.util.Optional<Pair<L,R>> reduce(QuaternaryFunction<L,R,L,R,Pair<L,R>> operator)
BiSequence into a single element by iteratively applying the given function to
the current result and each element in this sequence. The function is passed the left and right components of
the result pair, followed by the left and right components of the current pair, respectively.default Pair<L,R> reduce(Pair<L,R> identity, java.util.function.BinaryOperator<Pair<L,R>> operator)
BiSequence into a single element by iteratively applying the given binary operator to
the current result and each pair in this sequence, starting with the given identity as the initial result.default Pair<L,R> reduce(L left, R right, QuaternaryFunction<L,R,L,R,Pair<L,R>> operator)
BiSequence into a single element by iteratively applying the given binary operator to
the current result and each entry in this sequence, starting with the given identity as the initial result.
The function is passed the left and right components of the result, followed by the left and right components of
the current entry, respectively.default java.util.Optional<Pair<L,R>> first()
BiSequence or an empty Optional if there are no pairs in the
BiSequence.default java.util.Optional<Pair<L,R>> last()
BiSequence or an empty Optional if there are no pairs in the
BiSequence.default java.util.Optional<Pair<L,R>> at(int index)
Optional if the BiSequence is smaller
than the index.default java.util.Optional<Pair<L,R>> first(java.util.function.Predicate<? super Pair<L,R>> predicate)
BiSequence that matches the given predicate, or an empty
Optional if there are no matching pairs in the BiSequence.default java.util.Optional<Pair<L,R>> last(java.util.function.Predicate<? super Pair<L,R>> predicate)
BiSequence the matches the given predicate, or an empty Optional
if there are no matching pairs in the BiSequence.default java.util.Optional<Pair<L,R>> at(int index, java.util.function.Predicate<? super Pair<L,R>> predicate)
Optional if the BiSequence of matching pairs is smaller than the index.default java.util.Optional<Pair<L,R>> first(java.util.function.BiPredicate<? super L,? super R> predicate)
BiSequence that matches the given predicate, or an empty
Optional if there are no matching pairs in the BiSequence.default java.util.Optional<Pair<L,R>> last(java.util.function.BiPredicate<? super L,? super R> predicate)
BiSequence the matches the given predicate, or an empty Optional
if there are no matching pairs in the BiSequence.default java.util.Optional<Pair<L,R>> at(int index, java.util.function.BiPredicate<? super L,? super R> predicate)
Optional if the BiSequence of matching pairs is smaller than the index.default Sequence<BiSequence<L,R>> window(int window)
BiSequence into a Sequence of BiSequences of pairs, each
with the size of the given window. The first item in each sequence is the second item in the previous sequence.
The final sequence may be shorter than the window. This method is equivalent to window(window, 1).default Sequence<BiSequence<L,R>> window(int window, int step)
BiSequence into a sequence of BiSequences of elements, each with the
size of the given window, stepping step elements between each window. If the given step is less than the
window size, the windows will overlap each other. If the step is larger than the window size, elements will be
skipped in between windows.default Sequence<BiSequence<L,R>> batch(int size)
BiSequence into a sequence of BiSequences of distinct elements, each
with the given batch size. This method is equivalent to window(size, size).default Sequence<BiSequence<L,R>> batch(java.util.function.BiPredicate<? super Pair<L,R>,? super Pair<L,R>> predicate)
BiSequence into a sequence of BiSequences of distinct elements, where
the given predicate determines where to split the lists of partitioned elements. The predicate is given the
current and next item in the iteration, and if it returns true a partition is created between the elements.default Sequence<BiSequence<L,R>> batch(QuaternaryPredicate<? super L,? super R,? super L,? super R> predicate)
BiSequence into a sequence of BiSequences of distinct elements,
where the given predicate determines where to split the lists of partitioned elements. The predicate is given
the left and right values of the current and next items in the iteration, and if it returns true a partition is
created between the elements.default Sequence<BiSequence<L,R>> split(Pair<L,R> element)
BiSequence into a sequence of BiSequences of distinct elements,
around the given element. The elements around which the sequence is split are not included in the result.default Sequence<BiSequence<L,R>> split(java.util.function.Predicate<? super Pair<L,R>> predicate)
BiSequence into a sequence of BiSequences of distinct elements,
where the given predicate determines which elements to split the partitioned elements around. The elements
matching the predicate are not included in the result.default Sequence<BiSequence<L,R>> split(java.util.function.BiPredicate<? super L,? super R> predicate)
BiSequence into a sequence of BiSequences of distinct elements,
where the given predicate determines which elements to split the partitioned elements around. The elements
matching the predicate are not included in the result.default BiSequence<L,R> step(int step)
BiSequence.default BiSequence<L,R> distinct()
BiSequence where each item in this BiSequence occurs only once, the first time it is
encountered.default BiSequence<L,R> sorted()
BiSequence sorted according to the natural order.default BiSequence<L,R> sorted(java.util.Comparator<? super Pair<? extends L,? extends R>> comparator)
BiSequence sorted according to the given Comparator.default java.util.Optional<Pair<L,R>> min()
BiSequence.default java.util.Optional<Pair<L,R>> max()
BiSequence.default java.util.Optional<Pair<L,R>> min(java.util.Comparator<? super Pair<L,R>> comparator)
BiSequence according to the given Comparator.default java.util.Optional<Pair<L,R>> max(java.util.Comparator<? super Pair<L,R>> comparator)
BiSequence according to the given Comparator.default boolean all(java.util.function.BiPredicate<? super L,? super R> biPredicate)
BiSequence satisfy the given predicate, false otherwise.default boolean none(java.util.function.BiPredicate<? super L,? super R> predicate)
BiSequence satisfy the given predicate, false otherwise.default boolean any(java.util.function.BiPredicate<? super L,? super R> biPredicate)
BiSequence satisfies the given predicate, false otherwise.default BiSequence<L,R> peek(java.util.function.BiConsumer<? super L,? super R> action)
BiConsumer to see the components of each pair in this BiSequence as it is
traversed.default BiSequence<L,R> peek(java.util.function.Consumer<? super Pair<L,R>> consumer)
Consumer to see each pair in this BiSequence as it is traversed.default BiSequence<L,R> peekIndexed(ObjObjIntConsumer<? super L,? super R> action)
ObjObjIntConsumer to see the components of each pair with their index as this
BiSequence is traversed.default BiSequence<L,R> peekIndexed(java.util.function.ObjIntConsumer<? super Pair<L,R>> action)
ObjLongConsumer to see each pair with its index as this BiSequence is
traversed.default BiSequence<L,R> append(java.util.Iterator<? extends Pair<L,R>> iterator)
Iterator to the end of this BiSequence.
The appended elements will only be available on the first traversal of the resulting Sequence.
default BiSequence<L,R> append(java.lang.Iterable<? extends Pair<L,R>> that)
Iterable to the end of this BiSequence.default BiSequence<L,R> append(Pair<L,R>... entries)
BiSequence.default BiSequence<L,R> appendPair(L left, R right)
BiSequence.default BiSequence<L,R> append(java.util.stream.Stream<Pair<L,R>> stream)
Stream to the end of this BiSequence.
The appended elements will only be available on the first traversal of the resulting BiSequence.
default <T> Sequence<T> toSequence(java.util.function.BiFunction<? super L,? super R,? extends T> mapper)
BiSequence to a Sequence where each item is generated by the given mapper.default <T> Sequence<T> toSequence(java.util.function.Function<? super Pair<L,R>,? extends T> mapper)
BiSequence to a Sequence where each item is generated by the given mapper.default EntrySequence<L,R> toEntrySequence()
default CharSeq toChars(ToCharBiFunction<? super L,? super R> mapper)
default IntSequence toInts(java.util.function.ToIntBiFunction<? super L,? super R> mapper)
BiSequence to an IntSequence using the given mapper function to map each pair
to an int.default LongSequence toLongs(java.util.function.ToLongBiFunction<? super L,? super R> mapper)
BiSequence to a LongSequence using the given mapper function to map each pair to a
long.default DoubleSequence toDoubles(java.util.function.ToDoubleBiFunction<? super L,? super R> mapper)
BiSequence to a DoubleSequence using the given mapper function to map each pair
to a double.default CharSeq toChars(ToCharFunction<? super Pair<L,R>> mapper)
default IntSequence toInts(java.util.function.ToIntFunction<? super Pair<L,R>> mapper)
BiSequence to an IntSequence using the given mapper function to map each pair
to an int.default LongSequence toLongs(java.util.function.ToLongFunction<? super Pair<L,R>> mapper)
BiSequence to a LongSequence using the given mapper function to map each pair to a
long.default DoubleSequence toDoubles(java.util.function.ToDoubleFunction<? super Pair<L,R>> mapper)
BiSequence to a DoubleSequence using the given mapper function to map each pair
to a double.default BiSequence<L,R> repeat()
BiSequence forever, producing a sequence that never terminates unless the original sequence
is empty in which case the resulting sequence is also empty.default BiSequence<L,R> repeat(int times)
BiSequence the given number of times.default BiSequence<L,R> reverse()
BiSequence which iterates over this BiSequence in reverse order.default BiSequence<L,R> shuffle()
BiSequence which iterates over this BiSequence in random order.default BiSequence<L,R> shuffle(java.util.Random random)
BiSequence which iterates over this BiSequence in random order as determined by the
given random generator.default BiSequence<L,R> shuffle(java.util.function.Supplier<? extends java.util.Random> randomSupplier)
BiSequence which iterates over this BiSequence in random order as determined by the
given random generator. A new instance of Random is created by the given supplier at the start of each
iteration.default boolean contains(Pair<L,R> pair)
BiSequence contains the given pair, false otherwise.default boolean contains(L left, R right)
BiSequence contains the given pair, false otherwise.default boolean containsAll(Pair<L,R>... pairs)
BiSequence contains all of the given pairs, false otherwise.default boolean containsAny(Pair<L,R>... pairs)
BiSequence contains any of the given pairs, false otherwise.default boolean containsAll(java.lang.Iterable<? extends Pair<L,R>> pairs)
BiSequence contains all of the given pairs, false otherwise.default boolean containsAny(java.lang.Iterable<? extends Pair<L,R>> pairs)
BiSequence contains any of the given pairs, false otherwise.