Basic operations:
append(Object)appendAll(Iterable)insert(int, Object)insertAll(int, Iterable)prepend(Object)prependAll(Iterable)update(int, Object)remove(Object)removeAll(Object)removeAll(Iterable)removeAt(int)removeFirst(Predicate)removeLast(Predicate)get(int)indexOf(Object)indexOf(Object, int)lastIndexOf(Object)lastIndexOf(Object, int)slice(int, int)subSequence(int)subSequence(int, int)| Modifier and Type | Field and Description |
|---|---|
| public static final long |
| Modifier and Type | Method and Description |
|---|---|
| public Seq | Returns: A new Seq containing the given element appended to this elementsAn element element)Appends an element to this. |
| public Seq | |
| public default T | Returns: the element at the given indexan index index)Implements io.
Deprecated
Will be removed
A |
| public List | asJava()
Creates an immutable |
| public Seq | Returns: this instanceA side-effecting unit of work that operates on an immutable action)java.util.List view.Creates an immutable |
| public List | asJavaMutable()
Creates a mutable |
| public Seq | Returns: this instance, if only read operations are performed on thejava.util.List view or a new instance of this type, if write operations are performed on the java.util.List view.A side-effecting unit of work that operates on a mutable action)java.util.List view.Creates a mutable |
| public PartialFunction | Returns: a newPartialFunctionTurns this |
| public <R> Seq | collect(PartialFunction<? super T, ? extends R>
A function that is not necessarily defined of all elements of this traversable. partialFunction)Redeclares io. Collects all elements that are in the domain of the given |
| public Seq | Returns: the combinations of thisReturns the union of all combinations from k = 0 to length(). |
| public Seq | Returns: the k-combination of this elementsSize 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.the sequence to test that)Tests whether this sequence contains a given sequence as a slice. |
| public default Iterator | Returns: a new Iterator containing the square ofthisCalculates the cross product (, i.e. square) of |
| public Iterator | Returns: A new Iterator representing the n-ary cartesian power of thisthe 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 | Returns: a new Iterator containing the cross productthis x thatAnother iterable that)Calculates the cross product |
| public Seq | distinct()
Redeclares io. Returns a new version of this which contains no duplicates. |
| public Seq | distinctBy(Comparator<? super T>
A comparator comparator)Redeclares io. Returns a new version of this which contains no duplicates. |
| public <U> Seq | distinctBy(Function<? super T, ? extends U>
A key extractor keyExtractor)Redeclares io. Returns a new version of this which contains no duplicates. |
| public Seq | drop(int
The number of elements to drop. n)Redeclares io. Drops the first n elements of this or all elements, if this length < n. |
| public Seq | dropRight(int
The number of elements to drop. n)Redeclares io. Drops the last n elements of this or all elements, if this length < n. |
| public Seq | Returns: a new instance consisting of all elements until and including the last one which does satisfy the given predicate.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 | Returns: a new instance consisting of all elements until and including the last one which does not satisfy the given predicate.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 | dropUntil(Predicate<? super T>
A condition tested subsequently for this elements. predicate)Redeclares io. Drops elements until the predicate holds for the current element. |
| public Seq | dropWhile(Predicate<? super T>
A condition tested subsequently for this elements. predicate)Redeclares io. Drops elements while the predicate holds for the current element. |
| public default boolean | |
| public Seq | filter(Predicate<? super T>
A predicate predicate)Redeclares io. Returns a new traversable consisting of all elements which satisfy the given predicate. |
| public <U> Seq | flatMap(Function<? super T, ? extends Iterable<? extends U>>
A mapper mapper)Redeclares io. 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. Folds this elements from the right, starting with |
| public T | Returns: the element at the given indexan index index)Returns the element at the specified index. |
| public <C> Map | groupBy(Function<? super T, ? extends C>
A function which classifies elements into classes classifier)Redeclares io. Groups this elements by classifying the elements. |
| public Iterator | grouped(int
a positive block size size)Redeclares io. Groups this |
| public default int | Returns: the index of the first occurrence of the given elementan 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 elementan 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 | Returns: Some(index) or None if not found.an element element)Returns the index of the first occurrence of the given element as an |
| public default Option | Returns: Some(index) or None if not found.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 |
| 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.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.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 | Returns: Some(index) or None if not found.the sequence to test that)Finds first index where this sequence contains a given sequence as an |
| public default Option | Returns: Some(index) or None if not found.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 |
| public default int | Returns: the index of the first element of this Seq that satisfies the givenpredicate, or -1, if none exists.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.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 | Returns: Some(index) or None if not found.the predicate used to test elements. predicate)Finds index of first element satisfying some predicate as an |
| public default Option | Returns: Some(index) or None if not found.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 |
| public Seq | init()
Redeclares io. Dual of tail(), returning all elements except the last. |
| public Option | initOption()
Redeclares as abstract: io. Dual of tailOption(), returning all elements except the last as |
| public Seq | Returns: a new Seq, where the given element is inserted into this at the given indexan index index, T an element element)Inserts the given element at the specified index. |
| public Seq | |
| public Seq | Returns: an interspersed version of thisAn element. element)Inserts an element between all elements of this Traversable. |
| public default boolean | isSequential()
Overrides default io. Checks if the elements of this Traversable appear in encounter order. |
| public default Iterator | Returns: a new Iterator, starting with the element at the given index or the empty Iterator, if index = length()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 elementan 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 elementan 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 | Returns: Some(index) or None if not found.an element element)Returns the index of the last occurrence of the given element as an |
| public default Option | Returns: Some(index) or None if not found.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 |
| 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.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.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 | Returns: Some(index) or None if not found.the sequence to test that)Finds last index where this sequence contains a given sequence as a slice as an |
| public default Option | Returns: Some(index) or None if not found.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 |
| public default int | Returns: the index of the last element of this Seq that satisfies the givenpredicate, or -1,
if none exists.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.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 | Returns: Some(index) or None if not found.the predicate used to test elements. predicate)Finds index of last element satisfying some predicate as an |
| public default Option | Returns: Some(index) or None if not found.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 |
| public Seq | Returns: a new sequence consisting of all elements of this sequence prepended by the minimal number of occurrences ofelement so that the resulting sequence has a length of at least length.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 | 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.Overrides default io.
Deprecated
Will be removed
Turns this sequence into a plain function returning an Option result. |
| public <U> Seq | map(Function<? super T, ? extends U>
A mapper. mapper)Redeclares io. Maps the elements of this |
| public static < Component type of the T> SeqSeq. | |
| public Seq | orElse(Iterable<? extends T>
An alternative other)TraversableRedeclares io. Returns this |
| public Seq | orElse(Supplier<? extends Iterable<? extends T>>
An alternative supplier)Traversable supplierRedeclares io. Returns this |
| public Seq | Returns: a new sequence consisting of all elements of this sequence followed by the minimal number of occurrences ofelement so that the resulting sequence has a length of at least length.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 | partition(Predicate<? super T>
A predicate which classifies an element if it is in the first or the second traversable. predicate)Redeclares io. Creates a partition of this |
| public Seq | |
| public Seq | peek(Consumer<? super T>
The action that will be performed on the element(s). action)Redeclares io. Performs the given |
| public Seq | |
| 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.the predicate used to test elements. predicate)Returns the length of the longest prefix whose elements all satisfy some predicate. |
| public Seq | Returns: A new Seq containing the given element prepended to this elementsAn element element)Prepends an element to this. |
| public Seq | Returns: A new Seq containing the given elements prepended to this elementsAn Iterable of elements elements)Prepends all given elements to this. |
| public Seq | reject(Predicate<? super T>
A predicate predicate)Redeclares as abstract: io. Returns a new traversable consisting of all elements which do not satisfy the given predicate. |
| public Seq | Returns: a Seq containing all elements of this without the first occurrence of the given element.An element to be removed from this Seq. element)Removes the first occurrence of the given element. |
| public Seq | Returns: a Seq containing all elements of this but not the given element.An element to be removed from this Seq. element)Removes all occurrences of the given element. |
| public Seq | |
| public Seq | Returns: a new Seqthe 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 | Returns: a sequence containing all elements of this without the element at the specified position.position of element to remove index)Removes the element at the specified position in this sequence. |
| public Seq | Returns: a new Seqan predicate predicate)Removes the first occurrence that satisfy predicate |
| public Seq | Returns: a new Seqan predicate predicate)Removes the last occurrence that satisfy predicate |
| public Seq | replace(T
An element to be substituted. currentElement, T A replacement for currentElement. newElement)Redeclares io. Replaces the first occurrence (if exists) of the given currentElement with newElement. |
| public Seq | replaceAll(T
An element to be substituted. currentElement, T A replacement for currentElement. newElement)Redeclares io. Replaces all occurrences of the given currentElement with newElement. |
| public Seq | retainAll(Iterable<? extends T>
Elements to be kept. elements)Redeclares io. Keeps all occurrences of the given elements from this. |
| public Seq | |
| public Iterator | Returns: an iterator yielding the elements of this Seq in reversed orderAn iterator yielding elements in reversed order. |
| public Seq | Returns: the rotated elements.distance of left rotation n)Circular rotates the elements by the specified distance to the left direction. |
| public Seq | Returns: the rotated elements.distance of right rotation n)Circular rotates the elements by the specified distance to the right direction. |
| public Seq | 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. Computes a prefix scan of the elements of the collection. |
| public <U> Seq | 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. Produces a collection containing cumulative results of applying the operator going left to right. |
| public <U> Seq | 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. 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.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.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.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 | Returns: a sequence with the same elements as the current sequence in a random order.Randomize the order of the elements in the current sequence. |
| public Seq | Returns: the specified slicethe beginning index, inclusive beginIndex, int the end index, exclusive endIndex)Returns a Seq that is a slice of this. |
| public Iterator | slideBy(Function<? super T, ?>
A function which classifies elements into classes classifier)Redeclares io. Slides a non-overlapping window of a variable size over this |
| public Iterator | sliding(int
a positive window size size)Redeclares io. Slides a window of a specific |
| public Iterator | sliding(int
a positive window size size, int a positive step size step)Redeclares io. Slides a window of a specific |
| public < The domain where elements are compared U extends Comparable | |
| public < The domain where elements are compared U> Seq | Returns: a sorted version of thisA comparator comparator, Function<? super T, ? extends U> A mapper mapper)Sorts this elements by comparing the elements in a different domain, using the given |
| public Seq | |
| public Seq | Returns: a sorted version of thisA comparator comparator)Sorts this elements according to the provided |
| public Tuple2 | span(Predicate<? super T>
A predicate. predicate)Redeclares io. Returns a tuple where the first element is the longest prefix of elements that satisfy the given
|
| public Tuple2 | |
| public Tuple2 | |
| public Tuple2 | Returns: ATuple containing divided sequencesAn predicate predicate)Splits a sequence at the first element which satisfies the |
| public default boolean | Returns: true if that is empty or that is prefix of this collection, false otherwise.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.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 | Returns: the specified subsequencethe beginning index, inclusive beginIndex)Returns a Seq that is a subsequence of this. |
| public Seq | Returns: the specified subsequencethe beginning index, inclusive beginIndex, int the end index, exclusive endIndex)Returns a Seq that is a subsequence of this. |
| public Seq | tail()
Redeclares io. Drops the first element of a non-empty Traversable. |
| public Option | tailOption()
Redeclares io. Drops the first element of a non-empty Traversable and returns an |
| public Seq | take(int
The number of elements to take. n)Redeclares io. Takes the first n elements of this or all elements, if this length < n. |
| public Seq | takeRight(int
The number of elements to take. n)Redeclares io. Takes the last n elements of this or all elements, if this length < n. |
| public Seq | Returns: a new instance consisting of all elements after the last one which does satisfy the given predicate.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 | Returns: a new instance consisting of all elements after the last one which does not satisfy the given predicate.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 | takeUntil(Predicate<? super T>
A condition tested subsequently for this elements. predicate)Redeclares io. Takes elements until the predicate holds for the current element. |
| public Seq | takeWhile(Predicate<? super T>
A condition tested subsequently for the contained elements. predicate)Redeclares io. Takes elements while the predicate holds for the current element. |
| public <T1, T2> Tuple2 | unzip(Function<? super T, Tuple2<? extends T1, ? extends T2>>
a function which converts elements of this to pairs unzipper)Redeclares io. Unzips this elements by mapping this elements to pairs which are subsequently split into two distinct sets. |
| public <T1, T2, T3> Tuple3 | unzip3(Function<? super T, Tuple3<? extends T1, ? extends T2, ? extends T3>>
a function which converts elements of this to pairs unzipper)Redeclares io. Unzips this elements by mapping this elements to triples which are subsequently split into three distinct sets. |
| public Seq | Returns: a new Seq consisting of all previous elements, with a single one (at the given index), changed to the new value.an index index, T an element element)Updates the given element at the specified index. |
| public Seq | Returns: a new Seq consisting of all previous elements, with a single one (at the given index), changed to the new value.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 | Returns: a total function from index to Tfunction 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 | Returns: a total function from index to Tdefault 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 | zip(Iterable<? extends U>
The Iterable providing the second half of each result pair. that)Redeclares io. Returns a traversable formed from this traversable and another Iterable collection by combining corresponding elements in pairs. |
| public <U> Seq | 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. Returns a traversable formed from this traversable and another Iterable by combining corresponding elements in pairs. |
| public <U, R> Seq | 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. Returns a traversable formed from this traversable and another Iterable collection by mapping elements. |
| public Seq | zipWithIndex()
Redeclares io. Zips this traversable with its indices. |
| public <U> Seq | zipWithIndex(BiFunction<? super T, ? super Integer, ? extends U>
a mapper. mapper)Redeclares io. Zips this traversable with its indices by applying mapper provided. |