- All Implemented Interfaces:
BaseSeq<T>
,Copyable<MSeq<T>>
,MSeq<T>
,Seq<T>
,Serializable
,Iterable<T>
,IntFunction<T>
,RandomAccess
- Since:
- 1.4
- Version:
- 3.4
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn a newSeq
with the givenvalues
appended.protected void
checkIndex
(int start, int end, int otherStart, int otherLength) copy()
Return a new copy of typeT
.Fill the sequence with values generated by the given factory.iterator()
Returns a list iterator over the elements in this sequence (in a proper sequence).<B> MSeq<B>
Builds a new sequence by applying a function to all elements of this sequence.Return a newSeq
with the givenvalues
prepended.void
Set thevalue
at the givenindex
.Fills the sequence with values of the given iterable.Fills the sequence with values of the given iterator.Fill the sequence with the given values.shuffle
(RandomGenerator random) Randomize thearray
using the givenRandomGenerator
object.sort
(int start, int end, Comparator<? super T> comparator) Sorts this sequence according to the order induced by the specifiedComparator
.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.void
swap
(int i, int j) Swap the elements at the two positions.void
Swap a given range with a range of the same size with another array.toISeq()
Return a read-only projection of this sequence.Methods inherited from class io.jenetics.internal.collection.ArraySeq
equals, forAll, forEach, get, hashCode, indexWhere, lastIndexWhere, length, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.jenetics.util.BaseSeq
forEach, get, isEmpty, length, nonEmpty, spliterator, stream
Methods inherited from interface io.jenetics.util.MSeq
append, asList, prepend, reverse, shuffle, sort, sort, sort, sort, sort, swap
Methods inherited from interface io.jenetics.util.Seq
apply, asISeq, 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
-
Constructor Details
-
ArrayMSeq
-
-
Method Details
-
copy
Description copied from interface:Copyable
Return a new copy of typeT
. -
iterator
-
listIterator
Description copied from interface:MSeq
Returns a list iterator over the elements in this sequence (in a proper sequence).- Specified by:
listIterator
in interfaceBaseSeq<T>
- Specified by:
listIterator
in interfaceMSeq<T>
- Returns:
- a list iterator over the elements in this list (in a proper sequence)
-
set
Description copied from interface:MSeq
Set thevalue
at the givenindex
. -
setAll
Description copied from interface:MSeq
Fills the sequence with values of the given iterator. -
setAll
Description copied from interface:MSeq
Fills the sequence with values of the given iterable. -
setAll
Description copied from interface:MSeq
Fill the sequence with the given values. -
fill
Description copied from interface:MSeq
Fill the sequence with values generated by the given factory. -
sort
Description copied from interface:MSeq
Sorts this sequence according to the order induced by the specifiedComparator
.All elements in this sequence must be mutually comparable using the specified comparator (that is,
c.compare(e1, e2)
must not throw aClassCastException
for any elementse1
ande2
in the sequence).If the specified comparator is
null
then all elements in this list must implement theComparable
interface and the elements' Comparable natural ordering should be used.- Specified by:
sort
in interfaceMSeq<T>
- Parameters:
start
- the start index where to start sorting (inclusively)end
- the end index where to stop sorting (exclusively)comparator
- theComparator
used to compare sequence elements. Anull
value indicates that the elements' Comparable natural ordering should be used- Returns:
this
sequence
-
shuffle
Description copied from interface:MSeq
Randomize thearray
using the givenRandomGenerator
object. The used shuffling algorithm is from D. Knuth TAOCP, Seminumerical Algorithms, Third edition, page 142, Algorithm S (Selection sampling technique).- Specified by:
shuffle
in interfaceMSeq<T>
- Parameters:
random
- theRandomGenerator
object to use for randomize.- Returns:
- this shuffled sequence
-
swap
Description copied from interface:MSeq
Swap the elements at the two positions. -
swap
Description copied from interface:MSeq
Swap a given range with a range of the same size with another array.start end | | this: +---+---+---+---+---+---+---+---+---+---+---+---+ +---------------+ +---------------+ other: +---+---+---+---+---+---+---+---+---+---+---+---+ | otherStart
-
checkIndex
-
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 sub-sequence 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 interfaceMSeq<T>
- 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. -
prepend
Description copied from interface:Seq
Return a newSeq
with the givenvalues
prepended. -
toISeq
Description copied from interface:MSeq
Return a read-only projection of this sequence. Changes to the original sequence will not influence the returnedISeq
.
-