- All Superinterfaces:
BaseSeq<T>
,Copyable<MSeq<T>>
,IntFunction<T>
,Iterable<T>
,RandomAccess
,Seq<T>
- All Known Implementing Classes:
io.jenetics.internal.collection.ArrayISeq
,CharSeq
Immutable, ordered, fixed sized sequence.
- Since:
- 1.0
- Version:
- 5.2
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn a newSeq
with the givenvalues
appended.Return a newSeq
with the givenvalues
appended.static <T> ISeq
<T> Return a sequence whose elements are all the elements of the first sequence followed by all the elements of the second sequence.static <T> ISeq
<T> Return a sequence whose elements are all the elements of the first sequence followed by all the elements of the vararg array.static <T> ISeq
<T> Return a sequence whose elements are all the elements of the first element followed by all the elements of the sequence.copy()
Return a shallow copy of this sequence.static <T> ISeq
<T> empty()
Return an emptyISeq
.<B> ISeq
<B> Builds a new sequence by applying a function to all elements of this sequence.static <T> ISeq
<T> Create a newISeq
from the given values.static <T> ISeq
<T> Creates a new sequence, which is filled with objects created be the givensupplier
.static <T> ISeq
<T> of
(T... values) Create a newISeq
from the given values.Return a newSeq
with the givenvalues
prepended.Return a newSeq
with the givenvalues
prepended.subSeq
(int start) Returns a view of the portion of this sequence between the specifiedstart
, inclusive, andend
, exclusive.subSeq
(int start, int end) Returns a view of the portion of this sequence between the specifiedstart
, inclusive, andend
, exclusive.toISeq()
Returns aCollector
that accumulates the input elements into a newISeq
.toISeq
(int maxSize) Returns aCollector
that accumulates the lastn
input elements into a newISeq
.static <A,
B extends A>
ISeq<A> Allows a safe (without compiler warning) upcast fromB
toA
.Methods inherited from interface io.jenetics.util.BaseSeq
forEach, get, isEmpty, iterator, length, listIterator, nonEmpty, spliterator, stream
Methods inherited from interface io.jenetics.util.Seq
apply, asISeq, asList, asMSeq, contains, equals, forAll, hashCode, indexOf, indexOf, indexOf, indexWhere, indexWhere, indexWhere, isSorted, isSorted, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexWhere, lastIndexWhere, lastIndexWhere, parallelStream, size, toArray, toArray, toArray, toString, toString
-
Field Details
-
EMPTY
Single instance of an emptyISeq
.- Since:
- 3.3
-
-
Method Details
-
subSeq
Description copied from interface:Seq
Returns a view of the portion of this sequence between the specifiedstart
, inclusive, andend
, exclusive. (Ifstart
andend
are equal, the returned sequence has length zero.) The returned sequence is backed by this sequence, so non-structural changes in the returned sequence are reflected in this array, and vice versa.This method eliminates the need for explicit range operations (of the populationSort that commonly exist for arrays). Any operation that expects an array can be used as a range operation by passing a subsequence view instead of a whole sequence.
-
subSeq
Description copied from interface:Seq
Returns a view of the portion of this sequence between the specifiedstart
, inclusive, andend
, exclusive. (Ifstart
andend
are equal, the returned sequence has length zero.) The returned sequence is backed by this sequence, so non-structural changes in the returned sequence are reflected in this sequence, and vice versa.This method eliminates the need for explicit range operations (of the populationSort that commonly exist for arrays). Any operation that expects a sequence can be used as a range operation by passing a subsequence view instead of a whole sequence.
-
map
Description copied from interface:Seq
Builds a new sequence by applying a function to all elements of this sequence.- Specified by:
map
in interfaceSeq<T>
- Type Parameters:
B
- the element type of the returned collection.- Parameters:
mapper
- the function to apply to each element.- Returns:
- a new sequence of type That resulting from applying the given function f to each element of this sequence and collecting the results.
-
append
Description copied from interface:Seq
Return a newSeq
with the givenvalues
appended. -
append
Description copied from interface:Seq
Return a newSeq
with the givenvalues
appended. -
prepend
Description copied from interface:Seq
Return a newSeq
with the givenvalues
prepended. -
prepend
Description copied from interface:Seq
Return a newSeq
with the givenvalues
prepended. -
copy
Return a shallow copy of this sequence. The sequence elements are not cloned. -
concat
Return a sequence whose elements are all the elements of the first element followed by all the elements of the sequence.- Type Parameters:
T
- the type of the sequence elements- Parameters:
a
- the first elementb
- the appending sequence- Returns:
- the concatenation of the two inputs
- Throws:
NullPointerException
- if one of the second arguments isnull
- Since:
- 5.0
-
concat
Return a sequence whose elements are all the elements of the first sequence followed by all the elements of the vararg array.- Type Parameters:
T
- the type of the sequence elements- Parameters:
a
- the first sequenceb
- the vararg elements- Returns:
- the concatenation of the two inputs
- Throws:
NullPointerException
- if one of the arguments isnull
- Since:
- 5.0
-
concat
Return a sequence whose elements are all the elements of the first sequence followed by all the elements of the second sequence.- Type Parameters:
T
- the type of the sequence elements- Parameters:
a
- the first sequenceb
- the second sequence- Returns:
- the concatenation of the two input sequences
- Throws:
NullPointerException
- if one of the arguments isnull
- Since:
- 5.0
-
empty
Return an emptyISeq
.- Type Parameters:
T
- the element type of the returnedISeq
.- Returns:
- an empty
ISeq
. - Since:
- 3.3
-
toISeq
Returns aCollector
that accumulates the input elements into a newISeq
.- Type Parameters:
T
- the type of the input elements- Returns:
- a
Collector
which collects all the input elements into anISeq
, in encounter order
-
toISeq
Returns aCollector
that accumulates the lastn
input elements into a newISeq
.- Type Parameters:
T
- the type of the input elements- Parameters:
maxSize
- the maximal size of the collected sequence- Returns:
- a
Collector
which collects maximalmaxSize
of the input elements into anISeq
, in encounter order - Throws:
IllegalArgumentException
- if themaxSize
is negative- Since:
- 5.0
-
of
Create a newISeq
from the given values.- Type Parameters:
T
- the element type- Parameters:
values
- the array values.- Returns:
- a new
ISeq
with the given values. - Throws:
NullPointerException
- if thevalues
array isnull
.
-
of
Create a newISeq
from the given values.- Type Parameters:
T
- the element type- Parameters:
values
- the array values.- Returns:
- a new
ISeq
with the given values. - Throws:
NullPointerException
- if thevalues
array isnull
.
-
of
Creates a new sequence, which is filled with objects created be the givensupplier
.- Type Parameters:
T
- the element type of the sequence- Parameters:
supplier
- theSupplier
which creates the elements, the returned sequence is filled withlength
- the length of the returned sequence- Returns:
- a new sequence filled with elements given by the
supplier
- Throws:
NegativeArraySizeException
- if the givenlength
is negativeNullPointerException
- if the givensupplier
isnull
- Since:
- 3.2
-
upcast
Allows a safe (without compiler warning) upcast fromB
toA
. SinceISeq
instances are immutable, an upcast will be always safe.// The sequence which we want to case. final ISeq<? extends Number> ints = ISeq.of(1, 2, 3, 4, 5); // These casts are possible without warning. final ISeq<Object> objects = ISeq.upcast(ints); final ISeq<Number> numbers = ISeq.upcast(ints); // This cast will, of course, still fail. final ISeq<String> strings = ISeq.upcast(ints); final ISeq<Integer> integers = ISeq.upcast(ints);
- Type Parameters:
A
- the super-object typeB
- the sub-object type- Parameters:
seq
- the sequence to cast safely- Returns:
- the cast instance of the given
seq
- Since:
- 3.6
-