Top Description Fields Constructors Methods
io.vavr.collection

public final Class Vector<T>

Additional top-level class in compilation unit: VectorModule.

extends Object
implements IndexedSeq<T>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, io.vavr.collection.IndexedSeq, io.vavr.collection.Seq, io.vavr.PartialFunction, io.vavr.Function1, java.util.function.Function, io.vavr.collection.Traversable, io.vavr.Value, java.lang.Iterable, io.vavr.collection.Foldable
Type Parameters
<T>
Component type of the Vector.
Imports
io.vavr.*, io.vavr.collection.JavaConverters.ListView, .VectorModule.Combinations, io.vavr.control.Option, java.io.Serializable, java.util.*, java.util.function.*, java.util.stream.Collector

Vector is the default Seq implementation that provides effectively constant time access to any element. Many other operations (e.g. `tail`, `drop`, `slice`) are also effectively constant. The implementation is based on a `bit-mapped trie`, a very wide and shallow tree (i.e. depth ≤ 6).
Author
Ruslan Sennov, Pap Lőrinc

Field Summary

Modifier and TypeField and Description
private static final Vector<?>
private static final long
pack-priv final BitMappedTrie<T>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Vector<T>
append(T
An element
element
)

Implements io.vavr.collection.IndexedSeq.append.

Appends an element to this.

public Vector<T>
appendAll(Iterable<? extends T>
An Iterable of elements
iterable
)

Implements io.vavr.collection.IndexedSeq.appendAll.

Appends all given elements to this.

public List<T>
asJava()

Implements io.vavr.collection.Seq.asJava.

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

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

Implements io.vavr.collection.IndexedSeq.asJava.

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

public List<T>
asJavaMutable()

Implements io.vavr.collection.Seq.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 Vector<T>
asJavaMutable(Consumer<? super List<T>>
A side-effecting unit of work that operates on a mutable java.util.List view.
action
)

Implements io.vavr.collection.IndexedSeq.asJavaMutable.

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

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

Implements io.vavr.collection.IndexedSeq.collect.

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

public static <
Component type of the Vector.
T
>
Collector<T, ArrayList<T>, Vector<T>>

Returns:

A io.vavr.collection.List Collector.
collector
()

Returns a Collector which may be used in conjunction with java.util.stream.Stream#collect(Collector) to obtain a Vector.

public Vector<Vector<T>>
combinations()

Implements io.vavr.collection.IndexedSeq.combinations.

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

public Vector<Vector<T>>
combinations(int
Size of subsets
k
)

Implements io.vavr.collection.IndexedSeq.combinations.

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

public Iterator<Vector<T>>
crossProduct(int
the number of cartesian multiplications
power
)

Implements io.vavr.collection.IndexedSeq.crossProduct.

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

public Vector<T>
distinct()

Implements io.vavr.collection.IndexedSeq.distinct.

Returns a new version of this which contains no duplicates.

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

Implements io.vavr.collection.IndexedSeq.distinctBy.

Returns a new version of this which contains no duplicates.

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

Implements io.vavr.collection.IndexedSeq.distinctBy.

Returns a new version of this which contains no duplicates.

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

Implements io.vavr.collection.IndexedSeq.drop.

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

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

Implements io.vavr.collection.IndexedSeq.dropRight.

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

public Vector<T>
dropRightUntil(Predicate<? super T>
A condition tested subsequently for this elements, starting from the end.
predicate
)

Implements io.vavr.collection.IndexedSeq.dropRightUntil.

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

public Vector<T>
dropRightWhile(Predicate<? super T>
A condition tested subsequently for this elements, starting from the end.
predicate
)

Implements io.vavr.collection.IndexedSeq.dropRightWhile.

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

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

Implements io.vavr.collection.IndexedSeq.dropUntil.

Drops elements until the predicate holds for the current element.

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

Implements io.vavr.collection.IndexedSeq.dropWhile.

Drops elements while the predicate holds for the current element.

public static <
Component type.
T
>
Vector<T>

Returns:

The empty Vector.
empty
()

Returns the empty Vector.

public boolean
equals(Object
an object, may be null
o
)

Overrides java.lang.Object.equals.

Implements io.vavr.collection.Traversable.equals.

In Vavr there are four basic classes of collections:

  • Seq (sequential elements)
  • Set (distinct elements)
  • Map (indexed elements)
  • Multimap (indexed collections)
public static <
Component type of the Vector
T
>
Vector<T>

Returns:

A Vector of size n, where each element contains the result supplied by s.
fill
(int
The number of elements in the Vector
n
,
Supplier<? extends T>
The Supplier computing element values
s
)

Returns a Vector containing n values supplied by a given Supplier s.

public static <
Component type of the Vector
T
>
Vector<T>

Returns:

A Vector of size n, where each element is the given element.
fill
(int
The number of elements in the Vector
n
,
T
The element
element
)

Returns a Vector containing n times the given element

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

Implements io.vavr.collection.IndexedSeq.filter.

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

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

Implements io.vavr.collection.IndexedSeq.flatMap.

FlatMaps this Traversable.

public T
get(int
an index
index
)

Implements io.vavr.collection.Seq.get.

Returns the element at the specified index.

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

Implements io.vavr.collection.IndexedSeq.groupBy.

Groups this elements by classifying the elements.

public Iterator<Vector<T>>
grouped(int
a positive block size
size
)

Implements io.vavr.collection.IndexedSeq.grouped.

Groups this Traversable into fixed size blocks.

public boolean
hasDefiniteSize()

Implements io.vavr.collection.Traversable.hasDefiniteSize.

Checks if this Traversable is known to have a finite size.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements io.vavr.collection.Traversable.hashCode.

Returns the hash code of this collection.

public T
head()

Implements io.vavr.collection.Traversable.head.

Returns the first element of a non-empty Traversable.

public int
indexOf(T
an element
element
,
int
start index
from
)

Implements io.vavr.collection.Seq.indexOf.

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 Vector<T>
init()

Implements io.vavr.collection.IndexedSeq.init.

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

public Option<Vector<T>>
initOption()

Implements io.vavr.collection.IndexedSeq.initOption.

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

public Vector<T>
insert(int
an index
index
,
T
an element
element
)

Implements io.vavr.collection.IndexedSeq.insert.

Inserts the given element at the specified index.

public Vector<T>
insertAll(int
an index
index
,
Iterable<? extends T>
An Iterable of elements
elements
)

Implements io.vavr.collection.IndexedSeq.insertAll.

Inserts the given elements at the specified index.

public Vector<T>
intersperse(T
An element.
element
)

Implements io.vavr.collection.IndexedSeq.intersperse.

Inserts an element between all elements of this Traversable.

public boolean

Returns:

false
isAsync
()

Implements io.vavr.Value.isAsync.

A Vector is computed synchronously.

public boolean
isEmpty()

Overrides default io.vavr.collection.Traversable.isEmpty.

Checks if this Traversable is empty.

public boolean

Returns:

false
isLazy
()

Implements io.vavr.Value.isLazy.

A Vector is computed eagerly.

public boolean
isTraversableAgain()

Implements io.vavr.collection.Traversable.isTraversableAgain.

Checks if this Traversable can be repeatedly traversed.

private boolean
isValid(int index)

public Iterator<T>
iterator()

Overrides default io.vavr.collection.Traversable.iterator.

An iterator by means of head() and tail().

public int
lastIndexOf(T
an element
element
,
int
the end index
end
)

Implements io.vavr.collection.Seq.lastIndexOf.

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 Vector<T>
leftPadTo(int
the target length
length
,
T
the padding element
element
)

Implements io.vavr.collection.Seq.leftPadTo.

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

public int
length()

Implements io.vavr.collection.Traversable.length.

Computes the number of elements of this Traversable.

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

Implements io.vavr.collection.IndexedSeq.map.

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

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

Returns:

the given vector instance as narrowed type Vector<T>.
narrow
(Vector<? extends T>
An Vector.
vector
)

Narrows a widened Vector<?

public static <
The component type
T
>
Vector<T>

Returns:

A new Vector instance containing the given element
of
(T
An element.
element
)

Returns a singleton Vector, i.e. a Vector of one element.

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

Returns:

A vector containing the given elements in the same order.
of
(T...
Zero or more elements.
elements
)

Creates a Vector of the given elements.

private static <T> Vector<T>
public static <
Component type of the Vector.
T
>
Vector<T>

Returns:

A vector containing the given elements in the same order.
ofAll
(Iterable<? extends T>
An Iterable of elements.
iterable
)

Creates a Vector of the given elements.

public static <
Component type of the Stream.
T
>
Vector<T>

Returns:

A Vector containing the given elements in the same order.
ofAll
(Stream<? extends T> javaStream)

Creates a Vector that contains the elements of the given java.util.stream.Stream.

public static Vector<Boolean>

Returns:

A new Vector of Boolean values
ofAll
(boolean...
boolean values
elements
)

Creates a Vector from boolean values.

public static Vector<Byte>

Returns:

A new Vector of Byte values
ofAll
(byte...
byte values
elements
)

Creates a Vector from byte values.

public static Vector<Character>

Returns:

A new Vector of Character values
ofAll
(char...
char values
elements
)

Creates a Vector from char values.

public static Vector<Double>

Returns:

A new Vector of Double values
ofAll
(double...
double values
elements
)

Creates a Vector from double values.

public static Vector<Float>

Returns:

A new Vector of Float values
ofAll
(float...
float values
elements
)

Creates a Vector from float values.

public static Vector<Integer>

Returns:

A new Vector of Integer values
ofAll
(int...
int values
elements
)

Creates a Vector from int values.

public static Vector<Long>

Returns:

A new Vector of Long values
ofAll
(long...
long values
elements
)

Creates a Vector from long values.

public static Vector<Short>

Returns:

A new Vector of Short values
ofAll
(short...
short values
elements
)

Creates a Vector from short values.

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

Implements io.vavr.collection.IndexedSeq.orElse.

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

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

Implements io.vavr.collection.IndexedSeq.orElse.

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

public Vector<T>
padTo(int
the target length
length
,
T
the padding element
element
)

Implements io.vavr.collection.IndexedSeq.padTo.

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

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

Implements io.vavr.collection.IndexedSeq.partition.

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

public Vector<T>
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
)

Implements io.vavr.collection.IndexedSeq.patch.

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

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

Implements io.vavr.collection.IndexedSeq.peek.

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

public Vector<Vector<T>>
permutations()

Implements io.vavr.collection.IndexedSeq.permutations.

Computes all unique permutations.

public Vector<T>
prepend(T
An element
element
)

Implements io.vavr.collection.IndexedSeq.prepend.

Prepends an element to this.

public Vector<T>
prependAll(Iterable<? extends T>
An Iterable of elements
iterable
)

Implements io.vavr.collection.IndexedSeq.prependAll.

Prepends all given elements to this.

public static Vector<Character>
range(char from, char toExclusive)

public static Vector<Integer>

Returns:

a range of int values as specified or the empty range if from >= toExclusive
range
(int
the first number
from
,
int
the last number + 1
toExclusive
)

Creates a Vector of int numbers starting from from, extending to toExclusive - 1.

public static Vector<Long>

Returns:

a range of long values as specified or the empty range if from >= toExclusive
range
(long
the first number
from
,
long
the last number + 1
toExclusive
)

Creates a Vector of long numbers starting from from, extending to toExclusive - 1.

public static Vector<Character>
rangeBy(char from, char toExclusive, int step)

public static Vector<Double>
rangeBy(double from, double toExclusive, double step)

public static Vector<Integer>

Returns:

a range of long values as specified or the empty range if
from >= toInclusive and step > 0 or
from <= toInclusive and step < 0
rangeBy
(int
the first number
from
,
int
the last number + 1
toExclusive
,
int
the step
step
)

Creates a Vector of int numbers starting from from, extending to toExclusive - 1, with step.

public static Vector<Long>

Returns:

a range of long values as specified or the empty range if
from >= toInclusive and step > 0 or
from <= toInclusive and step < 0
rangeBy
(long
the first number
from
,
long
the last number + 1
toExclusive
,
long
the step
step
)

Creates a Vector of long numbers starting from from, extending to toExclusive - 1, with step.

public static Vector<Character>
rangeClosed(char from, char toInclusive)

public static Vector<Integer>

Returns:

a range of int values as specified or the empty range if from > toInclusive
rangeClosed
(int
the first number
from
,
int
the last number
toInclusive
)

Creates a Vector of int numbers starting from from, extending to toInclusive.

public static Vector<Long>

Returns:

a range of long values as specified or the empty range if from > toInclusive
rangeClosed
(long
the first number
from
,
long
the last number
toInclusive
)

Creates a Vector of long numbers starting from from, extending to toInclusive.

public static Vector<Character>
rangeClosedBy(char from, char toInclusive, int step)

public static Vector<Double>
rangeClosedBy(double from, double toInclusive, double step)

public static Vector<Integer>

Returns:

a range of int values as specified or the empty range if
from > toInclusive and step > 0 or
from < toInclusive and step < 0
rangeClosedBy
(int
the first number
from
,
int
the last number
toInclusive
,
int
the step
step
)

Creates a Vector of int numbers starting from from, extending to toInclusive, with step.

public static Vector<Long>

Returns:

a range of int values as specified or the empty range if
from > toInclusive and step > 0 or
from < toInclusive and step < 0
rangeClosedBy
(long
the first number
from
,
long
the last number
toInclusive
,
long
the step
step
)

Creates a Vector of long numbers starting from from, extending to toInclusive, with step.

private Object
public Vector<T>
reject(Predicate<? super T>
A predicate
predicate
)

Implements io.vavr.collection.IndexedSeq.reject.

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

public Vector<T>
remove(T
An element to be removed from this Seq.
element
)

Implements io.vavr.collection.IndexedSeq.remove.

Removes the first occurrence of the given element.

public Vector<T>
removeAll(T
An element to be removed from this Seq.
element
)

Implements io.vavr.collection.IndexedSeq.removeAll.

Removes all occurrences of the given element.

public Vector<T>
removeAll(Iterable<? extends T>
Elements to be removed from this Seq.
elements
)

Implements io.vavr.collection.IndexedSeq.removeAll, io.vavr.collection.IndexedSeq.removeAll.

Removes all occurrences of the given elements.

public Vector<T>
removeAll(Predicate<? super T>
the predicate used to test elements
predicate
)

Implements io.vavr.collection.IndexedSeq.removeAll, io.vavr.collection.IndexedSeq.removeAll.

Deprecated

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

public Vector<T>
removeAt(int
position of element to remove
index
)

Implements io.vavr.collection.IndexedSeq.removeAt.

Removes the element at the specified position in this sequence.

public Vector<T>
removeFirst(Predicate<T>
an predicate
predicate
)

Implements io.vavr.collection.IndexedSeq.removeFirst.

Removes the first occurrence that satisfy predicate

public Vector<T>
removeLast(Predicate<T>
an predicate
predicate
)

Implements io.vavr.collection.IndexedSeq.removeLast.

Removes the last occurrence that satisfy predicate

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

Implements io.vavr.collection.IndexedSeq.replace.

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

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

Implements io.vavr.collection.IndexedSeq.replaceAll.

Replaces all occurrences of the given currentElement with newElement.

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

Implements io.vavr.collection.IndexedSeq.retainAll.

Keeps all occurrences of the given elements from this.

public Vector<T>
reverse()

Implements io.vavr.collection.IndexedSeq.reverse.

Reverses the order of elements.

public Vector<T>
rotateLeft(int
distance of left rotation
n
)

Implements io.vavr.collection.IndexedSeq.rotateLeft.

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

public Vector<T>
rotateRight(int
distance of right rotation
n
)

Implements io.vavr.collection.IndexedSeq.rotateRight.

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

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

Implements io.vavr.collection.IndexedSeq.scan.

Computes a prefix scan of the elements of the collection.

public <U> Vector<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
)

Implements io.vavr.collection.IndexedSeq.scanLeft.

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

public <U> Vector<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
)

Implements io.vavr.collection.IndexedSeq.scanRight.

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

public Vector<T>
shuffle()

Implements io.vavr.collection.IndexedSeq.shuffle.

Randomize the order of the elements in the current sequence.

public Vector<T>
slice(int
the beginning index, inclusive
beginIndex
,
int
the end index, exclusive
endIndex
)

Implements io.vavr.collection.IndexedSeq.slice.

Returns a Seq that is a slice of this.

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

Implements io.vavr.collection.IndexedSeq.slideBy.

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

public Iterator<Vector<T>>
sliding(int
a positive window size
size
)

Implements io.vavr.collection.IndexedSeq.sliding.

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

public Iterator<Vector<T>>
sliding(int
a positive window size
size
,
int
a positive step size
step
)

Implements io.vavr.collection.IndexedSeq.sliding.

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

public <U extends Comparable<? super U>> Vector<T>
sortBy(Function<? super T, ? extends U>
A mapper
mapper
)

Implements io.vavr.collection.IndexedSeq.sortBy.

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

public <U> Vector<T>
sortBy(Comparator<? super U>
A comparator
comparator
,
Function<? super T, ? extends U>
A mapper
mapper
)

Implements io.vavr.collection.IndexedSeq.sortBy.

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

public Vector<T>
sorted()

Implements io.vavr.collection.IndexedSeq.sorted.

Sorts this elements according to their natural order.

public Vector<T>
sorted(Comparator<? super T>
A comparator
comparator
)

Implements io.vavr.collection.IndexedSeq.sorted.

Sorts this elements according to the provided Comparator.

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

Implements io.vavr.collection.IndexedSeq.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<Vector<T>, Vector<T>>
splitAt(int
An index.
n
)

Implements io.vavr.collection.Seq.splitAt.

Splits a Seq at the specified index.

public Tuple2<Vector<T>, Vector<T>>
splitAt(Predicate<? super T>
An predicate
predicate
)

Implements io.vavr.collection.Seq.splitAt.

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

public Tuple2<Vector<T>, Vector<T>>
splitAtInclusive(Predicate<? super T>
An predicate
predicate
)

Implements io.vavr.collection.Seq.splitAtInclusive.

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

public String
stringPrefix()

Implements io.vavr.Value.stringPrefix.

Returns the name of this Value type, which is used by toString().

public Vector<T>
subSequence(int
the beginning index, inclusive
beginIndex
)

Implements io.vavr.collection.IndexedSeq.subSequence.

Returns a Seq that is a subsequence of this.

public Vector<T>
subSequence(int
the beginning index, inclusive
beginIndex
,
int
the end index, exclusive
endIndex
)

Implements io.vavr.collection.IndexedSeq.subSequence.

Returns a Seq that is a subsequence of this.

public static <
Component type of the Vector
T
>
Vector<T>

Returns:

A Vector consisting of elements f(0),f(1), ..., f(n - 1)
tabulate
(int
The number of elements in the Vector
n
,
Function<? super Integer, ? extends T>
The Function computing element values
f
)

Returns a Vector containing n values of a given Function f over a range of integer values from 0 to n - 1.

public Vector<T>
tail()

Implements io.vavr.collection.IndexedSeq.tail.

Drops the first element of a non-empty Traversable.

public Option<Vector<T>>
tailOption()

Implements io.vavr.collection.IndexedSeq.tailOption.

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

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

Implements io.vavr.collection.IndexedSeq.take.

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

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

Implements io.vavr.collection.IndexedSeq.takeRight.

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

public Vector<T>
takeRightUntil(Predicate<? super T>
A condition tested subsequently for this elements, starting from the end.
predicate
)

Implements io.vavr.collection.IndexedSeq.takeRightUntil.

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

public Vector<T>
takeRightWhile(Predicate<? super T>
A condition tested subsequently for this elements, starting from the end.
predicate
)

Implements io.vavr.collection.IndexedSeq.takeRightWhile.

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

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

Implements io.vavr.collection.IndexedSeq.takeUntil.

Takes elements until the predicate holds for the current element.

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

Implements io.vavr.collection.IndexedSeq.takeWhile.

Takes elements while the predicate holds for the current element.

public String
toString()

Overrides java.lang.Object.toString.

Implements io.vavr.Value.toString.

Clarifies that values have a proper toString() method implemented.

public <
Type of transformation result
U
>
U

Returns:

An instance of type U
transform
(Function<? super Vector<T>, ? extends U>
A transformation
f
)

Transforms this Vector.

public static <
matrix element type
T
>
Vector<Vector<T>>

Returns:

a transposed Vector matrix.
transpose
(Vector<Vector<T>>
to be transposed.
matrix
)

Transposes the rows and columns of a Vector matrix.

public static <
type of seeds and unfolded values
T
>
Vector<T>

Returns:

a Vector with the values built up by the iteration
unfold
(T
the start value for the iteration
seed
,
Function<? super T, Option<Tuple2<? extends T, ? extends T>>>
the function to get the next step of the iteration
f
)

Creates a Vector from a seed value and a function.

public static <
type of seeds
T
,
type of unfolded values
U
>
Vector<U>

Returns:

a Vector with the values built up by the iteration
unfoldLeft
(T
the start value for the iteration
seed
,
Function<? super T, Option<Tuple2<? extends T, ? extends U>>>
the function to get the next step of the iteration
f
)

Creates a Vector from a seed value and a function.

public static <
type of seeds
T
,
type of unfolded values
U
>
Vector<U>

Returns:

a Vector with the values built up by the iteration
unfoldRight
(T
the start value for the iteration
seed
,
Function<? super T, Option<Tuple2<? extends U, ? extends T>>>
the function to get the next step of the iteration
f
)

Creates a Vector from a seed value and a function.

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

Implements io.vavr.collection.IndexedSeq.unzip.

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

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

Implements io.vavr.collection.IndexedSeq.unzip3.

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

public Vector<T>
update(int
an index
index
,
T
an element
element
)

Implements io.vavr.collection.IndexedSeq.update.

Updates the given element at the specified index.

public Vector<T>
update(int
an index
index
,
Function<? super T, ? extends T>
a function transforming the previous value
updater
)

Implements io.vavr.collection.IndexedSeq.update, io.vavr.collection.IndexedSeq.update.

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

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

Implements io.vavr.collection.IndexedSeq.zip.

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

public <U> Vector<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
)

Implements io.vavr.collection.IndexedSeq.zipAll.

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

public <U, R> Vector<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
)

Implements io.vavr.collection.IndexedSeq.zipWith.

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

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

Implements io.vavr.collection.IndexedSeq.zipWithIndex.

Zips this traversable with its indices.

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

Implements io.vavr.collection.IndexedSeq.zipWithIndex.

Zips this traversable with its indices by applying mapper provided.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait