Top Description Fields Methods
io.vavr.collection

public Interface Seq<T>

extends Traversable<T>, PartialFunction<Integer, T>, Serializable
Known Direct Subinterfaces
io.vavr.collection.IndexedSeq, io.vavr.collection.LinearSeq
Type Parameters
<T>
Component type
Imports
io.vavr.*, io.vavr.control.Option, java.io.Serializable, java.util.Comparator, .Objects, java.util.function.*

Interface for immutable sequential data structures.

Basic operations:

Conversion: Filtering: Selection: Transformation: Traversal: Views:
Author
Daniel Dietrich

Field Summary

Modifier and TypeField and Description
public static final long

Method Summary

Modifier and TypeMethod and Description
public Seq<T>

Returns:

A new Seq containing the given element appended to this elements
append
(T
An element
element
)

Appends an element to this.

public Seq<T>

Returns:

A new Seq containing the given elements appended to this elements
appendAll
(Iterable<? extends T>
An Iterable of elements
elements
)

Appends all given elements to this.

public default T

Returns:

the element at the given index
apply
(Integer
an index
index
)

Implements io.vavr.PartialFunction.apply.

Deprecated Will be removed

A Seq is a partial function which returns the element at the specified index by calling get(int).

public List<T>

Returns:

A new immutable java.util.Collection view on this Traversable.
asJava
()

Creates an immutable java.util.List view on top of this Seq, i.e. calling mutators will result in UnsupportedOperationException at runtime.

public Seq<T>

Returns:

this instance
asJava
(Consumer<? super List<T>>
A side-effecting unit of work that operates on an immutable java.util.List view.
action
)

Creates an immutable java.util.List view on top of this Seq that is passed to the given action.

public List<T>

Returns:

A new mutable java.util.Collection view on this Traversable.
asJavaMutable
()

Creates a mutable java.util.List view on top of this Seq, i.e. all mutator methods of the java.util.List are implemented.

public Seq<T>

Returns:

this instance, if only read operations are performed on the java.util.List view or a new instance of this type, if write operations are performed on the java.util.List view.
asJavaMutable
(Consumer<? super List<T>>
A side-effecting unit of work that operates on a mutable java.util.List view.
action
)

Creates a mutable java.util.List view on top of this Seq that is passed to the given action.

public PartialFunction<Integer, T>

Returns:

a new PartialFunction
asPartialFunction
()

Turns this Seq into a PartialFunction which is defined at a specific index, if this Seq contains at least index + 1 elements.

public <R> Seq<R>
collect(PartialFunction<? super T, ? extends R>
A function that is not necessarily defined of all elements of this traversable.
partialFunction
)

Redeclares io.vavr.collection.Traversable.collect.

Collects all elements that are in the domain of the given partialFunction by mapping the elements to type R.

public Seq<? extends Seq<T>>

Returns:

the combinations of this
combinations
()

Returns the union of all combinations from k = 0 to length().

public Seq<? extends Seq<T>>

Returns:

the k-combination of this elements
combinations
(int
Size of subsets
k
)

Returns the k-combination of this traversable, i.e. all subset of this of k distinct elements.

public default boolean

Returns:

true if this sequence contains a slice with the same elements as that, otherwise false.
containsSlice
(Iterable<? extends T>
the sequence to test
that
)

Tests whether this sequence contains a given sequence as a slice.

public default Iterator<Tuple2<T, T>>

Returns:

a new Iterator containing the square of this
crossProduct
()

Calculates the cross product (, i.e. square) of this x this.

public Iterator<? extends Seq<T>>

Returns:

A new Iterator representing the n-ary cartesian power of this
crossProduct
(int
the number of cartesian multiplications
power
)

Calculates the n-ary cartesian power (or cross product or simply product) of this.

public default <
Component type
U
>
Iterator<Tuple2<T, U>>

Returns:

a new Iterator containing the cross product this x that
crossProduct
(Iterable<? extends U>
Another iterable
that
)

Calculates the cross product this x that.

public Seq<T>
distinct()

Redeclares io.vavr.collection.Traversable.distinct.

Returns a new version of this which contains no duplicates.

public Seq<T>
distinctBy(Comparator<? super T>
A comparator
comparator
)

Redeclares io.vavr.collection.Traversable.distinctBy.

Returns a new version of this which contains no duplicates.

public <U> Seq<T>
distinctBy(Function<? super T, ? extends U>
A key extractor
keyExtractor
)

Redeclares io.vavr.collection.Traversable.distinctBy.

Returns a new version of this which contains no duplicates.

public Seq<T>
drop(int
The number of elements to drop.
n
)

Redeclares io.vavr.collection.Traversable.drop.

Drops the first n elements of this or all elements, if this length < n.

public Seq<T>
dropRight(int
The number of elements to drop.
n
)

Redeclares io.vavr.collection.Traversable.dropRight.

Drops the last n elements of this or all elements, if this length < n.

public Seq<T>

Returns:

a new instance consisting of all elements until and including the last one which does satisfy the given predicate.
dropRightUntil
(Predicate<? super T>
A condition tested subsequently for this elements, starting from the end.
predicate
)

Drops elements until the predicate holds for the current element, starting from the end.

public Seq<T>

Returns:

a new instance consisting of all elements until and including the last one which does not satisfy the given predicate.
dropRightWhile
(Predicate<? super T>
A condition tested subsequently for this elements, starting from the end.
predicate
)

Drops elements while the predicate holds for the current element, starting from the end.

public Seq<T>
dropUntil(Predicate<? super T>
A condition tested subsequently for this elements.
predicate
)

Redeclares io.vavr.collection.Traversable.dropUntil.

Drops elements until the predicate holds for the current element.

public Seq<T>
dropWhile(Predicate<? super T>
A condition tested subsequently for this elements.
predicate
)

Redeclares io.vavr.collection.Traversable.dropWhile.

Drops elements while the predicate holds for the current element.

public default boolean

Returns:

true if this sequence has that as a suffix, false otherwise.
endsWith
(Seq<? extends T>
the sequence to test
that
)

Tests whether this sequence ends with the given sequence.

public Seq<T>
filter(Predicate<? super T>
A predicate
predicate
)

Redeclares io.vavr.collection.Traversable.filter.

Returns a new traversable consisting of all elements which satisfy the given predicate.

public <U> Seq<U>
flatMap(Function<? super T, ? extends Iterable<? extends U>>
A mapper
mapper
)

Redeclares io.vavr.collection.Traversable.flatMap.

FlatMaps this Traversable.

public default <U> U
foldRight(U
A zero element to start with.
zero
,
BiFunction<? super T, ? super U, ? extends U>
A function which combines elements.
f
)

Implements io.vavr.collection.Traversable.foldRight.

Folds this elements from the right, starting with zero and successively calling combine.

public T

Returns:

the element at the given index
get
(int
an index
index
)

Returns the element at the specified index.

public <C> Map<C, ? extends Seq<T>>
groupBy(Function<? super T, ? extends C>
A function which classifies elements into classes
classifier
)

Redeclares io.vavr.collection.Traversable.groupBy.

Groups this elements by classifying the elements.

public Iterator<? extends Seq<T>>
grouped(int
a positive block size
size
)

Redeclares io.vavr.collection.Traversable.grouped.

Groups this Traversable into fixed size blocks.

public default int

Returns:

the index of the first occurrence of the given element
indexOf
(T
an element
element
)

Returns the index of the first occurrence of the given element or -1 if this does not contain the given element.

public int

Returns:

the index of the first occurrence of the given element
indexOf
(T
an element
element
,
int
start index
from
)

Returns the index of the first occurrence of the given element after or at some start index or -1 if this does not contain the given element.

public default Option<Integer>

Returns:

Some(index) or None if not found.
indexOfOption
(T
an element
element
)

Returns the index of the first occurrence of the given element as an Option

public default Option<Integer>

Returns:

Some(index) or None if not found.
indexOfOption
(T
an element
element
,
int
start index
from
)

Returns the index of the first occurrence of the given element, after or at some start index as an Option

public default int

Returns:

the first index such that the elements of this sequence starting at this index match the elements of sequence that, or -1 of no such slice exists.
indexOfSlice
(Iterable<? extends T>
the sequence to test
that
)

Finds first index where this sequence contains a given sequence as a slice.

public int

Returns:

the first index >= from such that the elements of this sequence starting at this index match the elements of sequence that, or -1 of no such slice exists.
indexOfSlice
(Iterable<? extends T>
the sequence to test
that
,
int
the start index
from
)

Finds first index after or at a start index where this sequence contains a given sequence as a slice.

public default Option<Integer>

Returns:

Some(index) or None if not found.
indexOfSliceOption
(Iterable<? extends T>
the sequence to test
that
)

Finds first index where this sequence contains a given sequence as an Option of a slice.

public default Option<Integer>

Returns:

Some(index) or None if not found.
indexOfSliceOption
(Iterable<? extends T>
the sequence to test
that
,
int
the start index
from
)

Finds first index after or at a start index where this sequence contains a given sequence as an Option of a slice.

public default int

Returns:

the index of the first element of this Seq that satisfies the given predicate, or -1, if none exists.
indexWhere
(Predicate<? super T>
the predicate used to test elements.
predicate
)

Finds index of first element satisfying some predicate.

public int

Returns:

the index >= from of the first element of this Seq that satisfies the given predicate, or -1, if none exists.
indexWhere
(Predicate<? super T>
the predicate used to test elements.
predicate
,
int
the start index
from
)

Finds index of the first element satisfying some predicate after or at some start index.

public default Option<Integer>

Returns:

Some(index) or None if not found.
indexWhereOption
(Predicate<? super T>
the predicate used to test elements.
predicate
)

Finds index of first element satisfying some predicate as an Option.

public default Option<Integer>

Returns:

Some(index) or None if not found.
indexWhereOption
(Predicate<? super T>
the predicate used to test elements.
predicate
,
int
the start index
from
)

Finds index of the first element satisfying some predicate after or at some start index as an Option.

public Seq<T>
init()

Redeclares io.vavr.collection.Traversable.init.

Dual of tail(), returning all elements except the last.

public Option<? extends Seq<T>>
initOption()

Redeclares as abstract: io.vavr.collection.Traversable.initOption.

Dual of tailOption(), returning all elements except the last as Option.

public Seq<T>

Returns:

a new Seq, where the given element is inserted into this at the given index
insert
(int
an index
index
,
T
an element
element
)

Inserts the given element at the specified index.

public Seq<T>

Returns:

a new Seq, where the given elements are inserted into this at the given index
insertAll
(int
an index
index
,
Iterable<? extends T>
An Iterable of elements
elements
)

Inserts the given elements at the specified index.

public Seq<T>

Returns:

an interspersed version of this
intersperse
(T
An element.
element
)

Inserts an element between all elements of this Traversable.

public default boolean
isSequential()

Overrides default io.vavr.collection.Traversable.isSequential.

Checks if the elements of this Traversable appear in encounter order.

public default Iterator<T>

Returns:

a new Iterator, starting with the element at the given index or the empty Iterator, if index = length()
iterator
(int
an index
index
)

Returns an iterator of this elements starting at the given index.

public default int

Returns:

the index of the last occurrence of the given element
lastIndexOf
(T
an element
element
)

Returns the index of the last occurrence of the given element or -1 if this does not contain the given element.

public int

Returns:

the index of the last occurrence of the given element
lastIndexOf
(T
an element
element
,
int
the end index
end
)

Returns the index of the last occurrence of the given element before or at a given end index or -1 if this does not contain the given element.

public default Option<Integer>

Returns:

Some(index) or None if not found.
lastIndexOfOption
(T
an element
element
)

Returns the index of the last occurrence of the given element as an Option.

public default Option<Integer>

Returns:

Some(index) or None if not found.
lastIndexOfOption
(T
an element
element
,
int
the end index
end
)

Returns the index of the last occurrence of the given element before or at a given end index as an Option.

public default int

Returns:

the last index such that the elements of this sequence starting a this index match the elements of sequence that, or -1 of no such slice exists.
lastIndexOfSlice
(Iterable<? extends T>
the sequence to test
that
)

Finds last index where this sequence contains a given sequence as a slice.

public int

Returns:

the last index <= end such that the elements of this sequence starting at this index match the elements of sequence that, or -1 of no such slice exists.
lastIndexOfSlice
(Iterable<? extends T>
the sequence to test
that
,
int
the end index
end
)

Finds last index before or at a given end index where this sequence contains a given sequence as a slice.

public default Option<Integer>

Returns:

Some(index) or None if not found.
lastIndexOfSliceOption
(Iterable<? extends T>
the sequence to test
that
)

Finds last index where this sequence contains a given sequence as a slice as an Option.

public default Option<Integer>

Returns:

Some(index) or None if not found.
lastIndexOfSliceOption
(Iterable<? extends T>
the sequence to test
that
,
int
the end index
end
)

Finds last index before or at a given end index where this sequence contains a given sequence as a slice as an Option.

public default int

Returns:

the index of the last element of this Seq that satisfies the given predicate, or -1, if none exists.
lastIndexWhere
(Predicate<? super T>
the predicate used to test elements.
predicate
)

Finds index of last element satisfying some predicate.

public int

Returns:

the index <= end of the last element of this Seq that satisfies the given predicate, or -1, if none exists.
lastIndexWhere
(Predicate<? super T>
the predicate used to test elements.
predicate
,
int
the maximum index of the search
end
)

Finds index of last element satisfying some predicate before or at given end index.

public default Option<Integer>

Returns:

Some(index) or None if not found.
lastIndexWhereOption
(Predicate<? super T>
the predicate used to test elements.
predicate
)

Finds index of last element satisfying some predicate as an Option.

public default Option<Integer>

Returns:

Some(index) or None if not found.
lastIndexWhereOption
(Predicate<? super T>
the predicate used to test elements.
predicate
,
int
the maximum index of the search
end
)

Finds index of last element satisfying some predicate before or at given end index as an Option.

public Seq<T>

Returns:

a new sequence consisting of all elements of this sequence prepended by the minimal number of occurrences of element so that the resulting sequence has a length of at least length.
leftPadTo
(int
the target length
length
,
T
the padding element
element
)

A copy of this sequence with an element prepended until a given target length is reached.

public default Function1<Integer, Option<T>>

Returns:

a function that takes an index i and returns the value of this sequence in a Some if the index is within bounds, otherwise a None.
lift
()

Overrides default io.vavr.PartialFunction.lift.

Deprecated Will be removed

Turns this sequence into a plain function returning an Option result.

public <U> Seq<U>
map(Function<? super T, ? extends U>
A mapper.
mapper
)

Redeclares io.vavr.collection.Traversable.map.

Maps the elements of this Traversable to elements of a new type preserving their order, if any.

public static <
Component type of the Seq.
T
>
Seq<T>

Returns:

the given seq instance as narrowed type Seq<T>.
narrow
(Seq<? extends T>
A Seq.
seq
)

Narrows a widened Seq<?

public Seq<T>
orElse(Iterable<? extends T>
An alternative Traversable
other
)

Redeclares io.vavr.collection.Traversable.orElse.

Returns this Traversable if it is nonempty, otherwise return the alternative.

public Seq<T>
orElse(Supplier<? extends Iterable<? extends T>>
An alternative Traversable supplier
supplier
)

Redeclares io.vavr.collection.Traversable.orElse.

Returns this Traversable if it is nonempty, otherwise return the result of evaluating supplier.

public Seq<T>

Returns:

a new sequence consisting of all elements of this sequence followed by the minimal number of occurrences of element so that the resulting sequence has a length of at least length.
padTo
(int
the target length
length
,
T
the padding element
element
)

A copy of this sequence with an element appended until a given target length is reached.

public Tuple2<? extends Seq<T>, ? extends Seq<T>>
partition(Predicate<? super T>
A predicate which classifies an element if it is in the first or the second traversable.
predicate
)

Redeclares io.vavr.collection.Traversable.partition.

Creates a partition of this Traversable by splitting this elements in two in distinct traversables according to a predicate.

public Seq<T>

Returns:

a new sequence.
patch
(int
the index of the first replaced element
from
,
Iterable<? extends T>
sequence for replacement
that
,
int
the number of elements to drop in the original list
replaced
)

Produces a new list where a slice of elements in this list is replaced by another sequence.

public Seq<T>
peek(Consumer<? super T>
The action that will be performed on the element(s).
action
)

Redeclares io.vavr.collection.Traversable.peek.

Performs the given action on the first element if this is an eager implementation.

public Seq<? extends Seq<T>>

Returns:

this unique permutations
permutations
()

Computes all unique permutations.

public default int

Returns:

the length of the longest prefix of this general sequence such that every element of the segment satisfies the predicate p.
prefixLength
(Predicate<? super T>
the predicate used to test elements.
predicate
)

Returns the length of the longest prefix whose elements all satisfy some predicate.

public Seq<T>

Returns:

A new Seq containing the given element prepended to this elements
prepend
(T
An element
element
)

Prepends an element to this.

public Seq<T>

Returns:

A new Seq containing the given elements prepended to this elements
prependAll
(Iterable<? extends T>
An Iterable of elements
elements
)

Prepends all given elements to this.

public Seq<T>
reject(Predicate<? super T>
A predicate
predicate
)

Redeclares as abstract: io.vavr.collection.Traversable.reject.

Returns a new traversable consisting of all elements which do not satisfy the given predicate.

public Seq<T>

Returns:

a Seq containing all elements of this without the first occurrence of the given element.
remove
(T
An element to be removed from this Seq.
element
)

Removes the first occurrence of the given element.

public Seq<T>

Returns:

a Seq containing all elements of this but not the given element.
removeAll
(T
An element to be removed from this Seq.
element
)

Removes all occurrences of the given element.

public Seq<T>

Returns:

a Seq containing all elements of this but none of the given elements.
removeAll
(Iterable<? extends T>
Elements to be removed from this Seq.
elements
)

Removes all occurrences of the given elements.

public Seq<T>

Returns:

a new Seq
removeAll
(Predicate<? super T>
the predicate used to test elements
predicate
)
Deprecated Please use reject(Predicate)

Returns a new Seq consisting of all elements which do not satisfy the given predicate.

public Seq<T>

Returns:

a sequence containing all elements of this without the element at the specified position.
removeAt
(int
position of element to remove
index
)

Removes the element at the specified position in this sequence.

public Seq<T>

Returns:

a new Seq
removeFirst
(Predicate<T>
an predicate
predicate
)

Removes the first occurrence that satisfy predicate

public Seq<T>

Returns:

a new Seq
removeLast
(Predicate<T>
an predicate
predicate
)

Removes the last occurrence that satisfy predicate

public Seq<T>
replace(T
An element to be substituted.
currentElement
,
T
A replacement for currentElement.
newElement
)

Redeclares io.vavr.collection.Traversable.replace.

Replaces the first occurrence (if exists) of the given currentElement with newElement.

public Seq<T>
replaceAll(T
An element to be substituted.
currentElement
,
T
A replacement for currentElement.
newElement
)

Redeclares io.vavr.collection.Traversable.replaceAll.

Replaces all occurrences of the given currentElement with newElement.

public Seq<T>
retainAll(Iterable<? extends T>
Elements to be kept.
elements
)

Redeclares io.vavr.collection.Traversable.retainAll.

Keeps all occurrences of the given elements from this.

public Seq<T>

Returns:

the reversed elements.
reverse
()

Reverses the order of elements.

public Iterator<T>

Returns:

an iterator yielding the elements of this Seq in reversed order
reverseIterator
()

An iterator yielding elements in reversed order.

public Seq<T>

Returns:

the rotated elements.
rotateLeft
(int
distance of left rotation
n
)

Circular rotates the elements by the specified distance to the left direction.

public Seq<T>

Returns:

the rotated elements.
rotateRight
(int
distance of right rotation
n
)

Circular rotates the elements by the specified distance to the right direction.

public Seq<T>
scan(T
neutral element for the operator op
zero
,
BiFunction<? super T, ? super T, ? extends T>
the associative operator for the scan
operation
)

Redeclares io.vavr.collection.Traversable.scan.

Computes a prefix scan of the elements of the collection.

public <U> Seq<U>
scanLeft(U
the initial value
zero
,
BiFunction<? super U, ? super T, ? extends U>
the binary operator applied to the intermediate result and the element
operation
)

Redeclares io.vavr.collection.Traversable.scanLeft.

Produces a collection containing cumulative results of applying the operator going left to right.

public <U> Seq<U>
scanRight(U
the initial value
zero
,
BiFunction<? super T, ? super U, ? extends U>
the binary operator applied to the intermediate result and the element
operation
)

Redeclares io.vavr.collection.Traversable.scanRight.

Produces a collection containing cumulative results of applying the operator going right to left.

public int

Returns:

the index of the search element, if it is contained in the sequence; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the element would be inserted into the sequence. Note that this guarantees that the return value will be >= 0 if and only if the element is found.
search
(T
the element to find
element
)

Searches this sequence for a specific element.

public int

Returns:

the index of the search element, if it is contained in the sequence; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the element would be inserted into the sequence. Note that this guarantees that the return value will be >= 0 if and only if the element is found.
search
(T
the element to find
element
,
Comparator<? super T>
the comparator by which this sequence is ordered
comparator
)

Searches this sequence for a specific element.

public int

Returns:

the length of the longest segment of this sequence starting from index from such that every element of the segment satisfies the predicate p.
segmentLength
(Predicate<? super T>
the predicate used to test elements.
predicate
,
int
the index where the search starts.
from
)

Computes length of longest segment whose elements all satisfy some predicate.

public Seq<T>

Returns:

a sequence with the same elements as the current sequence in a random order.
shuffle
()

Randomize the order of the elements in the current sequence.

public Seq<T>

Returns:

the specified slice
slice
(int
the beginning index, inclusive
beginIndex
,
int
the end index, exclusive
endIndex
)

Returns a Seq that is a slice of this.

public Iterator<? extends Seq<T>>
slideBy(Function<? super T, ?>
A function which classifies elements into classes
classifier
)

Redeclares io.vavr.collection.Traversable.slideBy.

Slides a non-overlapping window of a variable size over this Traversable.

public Iterator<? extends Seq<T>>
sliding(int
a positive window size
size
)

Redeclares io.vavr.collection.Traversable.sliding.

Slides a window of a specific size and step size 1 over this Traversable by calling sliding(int, int).

public Iterator<? extends Seq<T>>
sliding(int
a positive window size
size
,
int
a positive step size
step
)

Redeclares io.vavr.collection.Traversable.sliding.

Slides a window of a specific size and step size over this Traversable.

public <
The domain where elements are compared
U extends Comparable<? super U>
>
Seq<T>

Returns:

a sorted version of this
sortBy
(Function<? super T, ? extends U>
A mapper
mapper
)

Sorts this elements by comparing the elements in a different domain, using the given mapper.

public <
The domain where elements are compared
U
>
Seq<T>

Returns:

a sorted version of this
sortBy
(Comparator<? super U>
A comparator
comparator
,
Function<? super T, ? extends U>
A mapper
mapper
)

Sorts this elements by comparing the elements in a different domain, using the given mapper.

public Seq<T>

Returns:

A sorted version of this
sorted
()

Sorts this elements according to their natural order.

public Seq<T>

Returns:

a sorted version of this
sorted
(Comparator<? super T>
A comparator
comparator
)

Sorts this elements according to the provided Comparator.

public Tuple2<? extends Seq<T>, ? extends Seq<T>>
span(Predicate<? super T>
A predicate.
predicate
)

Redeclares io.vavr.collection.Traversable.span.

Returns a tuple where the first element is the longest prefix of elements that satisfy the given predicate and the second element is the remainder.

public Tuple2<? extends Seq<T>, ? extends Seq<T>>

Returns:

A Tuple containing the first n and the remaining elements.
splitAt
(int
An index.
n
)

Splits a Seq at the specified index.

public Tuple2<? extends Seq<T>, ? extends Seq<T>>

Returns:

A Tuple containing divided sequences
splitAt
(Predicate<? super T>
An predicate
predicate
)

Splits a sequence at the first element which satisfies the Predicate, e.g. Tuple(init, element+tail).

public Tuple2<? extends Seq<T>, ? extends Seq<T>>

Returns:

A Tuple containing divided sequences
splitAtInclusive
(Predicate<? super T>
An predicate
predicate
)

Splits a sequence at the first element which satisfies the Predicate, e.g. Tuple(init+element, tail).

public default boolean

Returns:

true if that is empty or that is prefix of this collection, false otherwise.
startsWith
(Iterable<? extends T>
the sequence to test
that
)

Tests whether this list starts with the given sequence.

public default boolean

Returns:

true if that is empty or that is prefix of this collection starting from the given offset, false otherwise.
startsWith
(Iterable<? extends T>
the sequence to test
that
,
int
the index where the sequence is searched.
offset
)

Tests whether this list contains the given sequence at a given index.

public Seq<T>

Returns:

the specified subsequence
subSequence
(int
the beginning index, inclusive
beginIndex
)

Returns a Seq that is a subsequence of this.

public Seq<T>

Returns:

the specified subsequence
subSequence
(int
the beginning index, inclusive
beginIndex
,
int
the end index, exclusive
endIndex
)

Returns a Seq that is a subsequence of this.

public Seq<T>
tail()

Redeclares io.vavr.collection.Traversable.tail.

Drops the first element of a non-empty Traversable.

public Option<? extends Seq<T>>
tailOption()

Redeclares io.vavr.collection.Traversable.tailOption.

Drops the first element of a non-empty Traversable and returns an Option.

public Seq<T>
take(int
The number of elements to take.
n
)

Redeclares io.vavr.collection.Traversable.take.

Takes the first n elements of this or all elements, if this length < n.

public Seq<T>
takeRight(int
The number of elements to take.
n
)

Redeclares io.vavr.collection.Traversable.takeRight.

Takes the last n elements of this or all elements, if this length < n.

public Seq<T>

Returns:

a new instance consisting of all elements after the last one which does satisfy the given predicate.
takeRightUntil
(Predicate<? super T>
A condition tested subsequently for this elements, starting from the end.
predicate
)

Takes elements until the predicate holds for the current element, starting from the end.

public Seq<T>

Returns:

a new instance consisting of all elements after the last one which does not satisfy the given predicate.
takeRightWhile
(Predicate<? super T>
A condition tested subsequently for this elements, starting from the end.
predicate
)

Takes elements while the predicate holds for the current element, starting from the end.

public Seq<T>
takeUntil(Predicate<? super T>
A condition tested subsequently for this elements.
predicate
)

Redeclares io.vavr.collection.Traversable.takeUntil.

Takes elements until the predicate holds for the current element.

public Seq<T>
takeWhile(Predicate<? super T>
A condition tested subsequently for the contained elements.
predicate
)

Redeclares io.vavr.collection.Traversable.takeWhile.

Takes elements while the predicate holds for the current element.

public <T1, T2> Tuple2<? extends Seq<T1>, ? extends Seq<T2>>
unzip(Function<? super T, Tuple2<? extends T1, ? extends T2>>
a function which converts elements of this to pairs
unzipper
)

Redeclares io.vavr.collection.Traversable.unzip.

Unzips this elements by mapping this elements to pairs which are subsequently split into two distinct sets.

public <T1, T2, T3> Tuple3<? extends Seq<T1>, ? extends Seq<T2>, ? extends Seq<T3>>
unzip3(Function<? super T, Tuple3<? extends T1, ? extends T2, ? extends T3>>
a function which converts elements of this to pairs
unzipper
)

Redeclares io.vavr.collection.Traversable.unzip3.

Unzips this elements by mapping this elements to triples which are subsequently split into three distinct sets.

public Seq<T>

Returns:

a new Seq consisting of all previous elements, with a single one (at the given index), changed to the new value.
update
(int
an index
index
,
T
an element
element
)

Updates the given element at the specified index.

public Seq<T>

Returns:

a new Seq consisting of all previous elements, with a single one (at the given index), changed to the new value.
update
(int
an index
index
,
Function<? super T, ? extends T>
a function transforming the previous value
updater
)

Updates the given element at the specified index using the specified function.

public default Function1<Integer, T>

Returns:

a total function from index to T
withDefault
(Function<? super Integer, ? extends T>
function to evaluate for all out of bounds indexes.
defaultFunction
)
Deprecated Will be removed

Turns this sequence from a partial function into a total function that returns a value computed by defaultFunction for all indexes that are out of bounds.

public default Function1<Integer, T>

Returns:

a total function from index to T
withDefaultValue
(T
default value to return for out of bound indexes
defaultValue
)
Deprecated Will be removed

Turns this sequence from a partial function into a total function that returns defaultValue for all indexes that are out of bounds.

public <U> Seq<Tuple2<T, U>>
zip(Iterable<? extends U>
The Iterable providing the second half of each result pair.
that
)

Redeclares io.vavr.collection.Traversable.zip.

Returns a traversable formed from this traversable and another Iterable collection by combining corresponding elements in pairs.

public <U> Seq<Tuple2<T, U>>
zipAll(Iterable<? extends U>
The Iterable providing the second half of each result pair.
that
,
T
The element to be used to fill up the result if this traversable is shorter than that.
thisElem
,
U
The element to be used to fill up the result if that is shorter than this traversable.
thatElem
)

Redeclares io.vavr.collection.Traversable.zipAll.

Returns a traversable formed from this traversable and another Iterable by combining corresponding elements in pairs.

public <U, R> Seq<R>
zipWith(Iterable<? extends U>
The Iterable providing the second parameter of the mapper.
that
,
BiFunction<? super T, ? super U, ? extends R>
a mapper.
mapper
)

Redeclares io.vavr.collection.Traversable.zipWith.

Returns a traversable formed from this traversable and another Iterable collection by mapping elements.

public Seq<Tuple2<T, Integer>>
zipWithIndex()

Redeclares io.vavr.collection.Traversable.zipWithIndex.

Zips this traversable with its indices.

public <U> Seq<U>
zipWithIndex(BiFunction<? super T, ? super Integer, ? extends U>
a mapper.
mapper
)

Redeclares io.vavr.collection.Traversable.zipWithIndex.

Zips this traversable with its indices by applying mapper provided.

Inherited from io.vavr.collection.Traversable:
arrangeByaveragecontainsAllcountequalsexistsUniquefindfindLastfoldLeftforEachWithIndexgethasDefiniteSizehashCodeheadheadOptionisDistinctisEmptyisOrderedisSingleValuedisTraversableAgainiteratorlastlastOptionlengthmaxmaxBymaxByminminByminBymkCharSeqmkCharSeqmkCharSeqmkStringmkStringmkStringnarrownonEmptyproductreduceLeftreduceLeftOptionreduceRightreduceRightOptionsinglesingleOptionsizespliteratorsum
Inherited from io.vavr.PartialFunction:
getIfDefinedisDefinedAtunlift