- 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
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturn a newSeqwith the givenvaluesappended.Return a newSeqwith the givenvaluesappended.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 newISeqfrom 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 newISeqfrom the given values.Return a newSeqwith the givenvaluesprepended.Return a newSeqwith the givenvaluesprepended.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 aCollectorthat accumulates the input elements into a newISeq.toISeq(int maxSize) Returns aCollectorthat accumulates the lastninput elements into a newISeq.static <A,B extends A>
ISeq<A> Allows a safe (without compiler warning) upcast fromBtoA.Methods inherited from interface io.jenetics.util.BaseSeq
forEach, get, isEmpty, iterator, length, listIterator, nonEmpty, spliterator, streamMethods 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:SeqReturns a view of the portion of this sequence between the specifiedstart, inclusive, andend, exclusive. (Ifstartandendare 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:SeqReturns a view of the portion of this sequence between the specifiedstart, inclusive, andend, exclusive. (Ifstartandendare 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:SeqBuilds a new sequence by applying a function to all elements of this sequence.- Specified by:
mapin 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:SeqReturn a newSeqwith the givenvaluesappended. -
append
Description copied from interface:SeqReturn a newSeqwith the givenvaluesappended. -
prepend
Description copied from interface:SeqReturn a newSeqwith the givenvaluesprepended. -
prepend
Description copied from interface:SeqReturn a newSeqwith the givenvaluesprepended. -
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 aCollectorthat accumulates the input elements into a newISeq.- Type Parameters:
T- the type of the input elements- Returns:
- a
Collectorwhich collects all the input elements into anISeq, in encounter order
-
toISeq
Returns aCollectorthat accumulates the lastninput elements into a newISeq.- Type Parameters:
T- the type of the input elements- Parameters:
maxSize- the maximal size of the collected sequence- Returns:
- a
Collectorwhich collects maximalmaxSizeof the input elements into anISeq, in encounter order - Throws:
IllegalArgumentException- if themaxSizeis negative- Since:
- 5.0
-
of
Create a newISeqfrom the given values.- Type Parameters:
T- the element type- Parameters:
values- the array values.- Returns:
- a new
ISeqwith the given values. - Throws:
NullPointerException- if thevaluesarray isnull.
-
of
Create a newISeqfrom the given values.- Type Parameters:
T- the element type- Parameters:
values- the array values.- Returns:
- a new
ISeqwith the given values. - Throws:
NullPointerException- if thevaluesarray 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- theSupplierwhich 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 givenlengthis negativeNullPointerException- if the givensupplierisnull- Since:
- 3.2
-
upcast
Allows a safe (without compiler warning) upcast fromBtoA. SinceISeqinstances 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
-