| Modifier and Type | Field and Description |
|---|---|
static MSeq<?> |
EMPTY
Single instance of an empty
MSeq. |
| Modifier and Type | Method and Description |
|---|---|
static <T> MSeq<T> |
empty()
Return an empty
MSeq. |
default MSeq<T> |
fill(Supplier<? extends T> supplier)
Fill the sequence with values generated by the given factory.
|
ListIterator<T> |
listIterator()
Returns a list iterator over the elements in this sequence (in proper
sequence).
|
<B> MSeq<B> |
map(Function<? super T,? extends B> mapper)
Builds a new sequence by applying a function to all elements of this
sequence.
|
static <T> MSeq<T> |
of(Iterable<? extends T> values)
Create a new
MSeq from the given values. |
static <T> MSeq<T> |
of(Seq<T> values)
Create a new
MSeq from the values of the given Seq. |
static <T> MSeq<T> |
of(T... values)
Create a new
MSeq from the given values. |
static <T> MSeq<T> |
ofLength(int length)
Create a new
MSeq with the given length. |
void |
set(int index,
T value)
Set the
value at the given index. |
default MSeq<T> |
setAll(Iterable<? extends T> values)
Fills the sequence with values of the given iterable.
|
default MSeq<T> |
setAll(Iterator<? extends T> it)
Fills the sequence with values of the given iterator.
|
default MSeq<T> |
setAll(T[] values)
Fill the sequence with the given values.
|
default MSeq<T> |
shuffle()
|
default MSeq<T> |
shuffle(Random random)
Randomize the
array using the given Random object. |
MSeq<T> |
subSeq(int start)
Returns a view of the portion of this sequence between the specified
start, inclusive, and end, exclusive. |
MSeq<T> |
subSeq(int start,
int end)
Returns a view of the portion of this sequence between the specified
start, inclusive, and end, exclusive. |
default void |
swap(int i,
int j)
Swap the elements at the two positions.
|
default void |
swap(int start,
int end,
MSeq<T> other,
int otherStart)
Swap a given range with a range of the same size with another array.
|
ISeq<T> |
toISeq()
Return a read-only projection of this sequence.
|
static <T> Collector<T,?,MSeq<T>> |
toMSeq()
Returns a
Collector that accumulates the input elements into a
new MSeq. |
asList, contains, equals, equals, forAll, get, hashCode, hashCode, indexOf, indexOf, indexOf, indexWhere, indexWhere, indexWhere, isSorted, isSorted, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexWhere, lastIndexWhere, lastIndexWhere, length, parallelStream, size, spliterator, stream, toArray, toArray, toSeq, toString, toStringvoid set(int index, T value)
value at the given index.index - the index of the new value.value - the new value.IndexOutOfBoundsException - if the index is out of range
(index < 0 || index >= size()).default MSeq<T> setAll(Iterator<? extends T> it)
it - the iterator of the values to fill this sequence.this sequence.default MSeq<T> setAll(Iterable<? extends T> values)
values - the values to fill this sequence.this sequence.default MSeq<T> setAll(T[] values)
values - the first initial values of this sequencethis sequence.default MSeq<T> fill(Supplier<? extends T> supplier)
supplier - the value factory.this sequence.NullPointerException - if the given factory is null.default void swap(int i, int j)
i - the index of the first element.j - the index of the second element.IndexOutOfBoundsException - if i < 0 || j >= length().default void swap(int start, int end, MSeq<T> other, int otherStart)
start end
| |
this: +---+---+---+---+---+---+---+---+---+---+---+---+
+---------------+
+---------------+
other: +---+---+---+---+---+---+---+---+---+---+---+---+
|
otherStart
start - the start index of this range, inclusively.end - the end index of this range, exclusively.other - the other array to swap the elements with.otherStart - the start index of the other array.IndexOutOfBoundsException - if start > end or
if start < 0 || end >= this.length() || otherStart < 0 ||
otherStart + (end - start) >= other.length()default MSeq<T> shuffle()
array using the Random object currently
registered in the RandomRegistry class. The used shuffling
algorithm is from D. Knuth TAOCP, Seminumerical Algorithms, Third edition,
page 142, Algorithm S (Selection sampling technique).default MSeq<T> shuffle(Random random)
array using the given Random object. The used
shuffling algorithm is from D. Knuth TAOCP, Seminumerical Algorithms,
Third edition, page 142, Algorithm S (Selection sampling technique).random - the Random object to use for randomize.NullPointerException - if the random object is null.ListIterator<T> listIterator()
MSeq<T> subSeq(int start, int end)
Seqstart, inclusive, and end, exclusive. (If start
and end are equal, the returned sequence has the 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 an sub sequence view instead of an whole sequence.
MSeq<T> subSeq(int start)
Seqstart, inclusive, and end, exclusive. (If start
and end are equal, the returned sequence has the 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 an sequence can be used as a range operation by passing an sub sequence view instead of an whole sequence.
<B> MSeq<B> map(Function<? super T,? extends B> mapper)
Seqmap in interface Seq<T>B - the element type of the returned collection.mapper - the function to apply to each element.ISeq<T> toISeq()
ISeq.static <T> Collector<T,?,MSeq<T>> toMSeq()
Collector that accumulates the input elements into a
new MSeq.T - the type of the input elementsCollector which collects all the input elements into a
MSeq, in encounter orderstatic <T> MSeq<T> empty()
MSeq.T - the element type of the new MSeq.MSeq.static <T> MSeq<T> ofLength(int length)
MSeq with the given length.T - the element type of the new MSeq.length - the length of the created MSeq.@SafeVarargs static <T> MSeq<T> of(T... values)
MSeq from the given values.of in interface Seq<T>T - the element typevalues - the array values.Meq with the given values.NullPointerException - if the values array is null.static <T> MSeq<T> of(Iterable<? extends T> values)
MSeq from the given values.of in interface Seq<T>T - the element typevalues - the array values.MSeq with the given values.NullPointerException - if the values array is null.static <T> MSeq<T> of(Seq<T> values)
MSeq from the values of the given Seq.T - the element typevalues - the array values.MSeq with the given valuesNullPointerException - if the values array is null.© 2007-2014 Franz Wilhelmstötter (2014-12-28 10:45)