Modifier and Type | Method and Description |
---|---|
MSeq<T> |
fill(Factory<? extends T> factory)
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.
|
void |
set(int index,
T value)
Set the
value at the given index . |
MSeq<T> |
setAll(Iterable<? extends T> values)
Fills the sequence with values of the given iterable.
|
MSeq<T> |
setAll(Iterator<? extends T> it)
Fills the sequence with values of the given iterator.
|
MSeq<T> |
setAll(T value)
Set all sequence elements to the given
value . |
MSeq<T> |
setAll(T[] values)
Fill the sequence with the given values.
|
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. |
void |
swap(int i,
int j)
Swap the elements at the two positions.
|
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.
|
asList, contains, equals, forall, forAll, foreach, forEach, get, hashCode, indexOf, indexOf, indexOf, indexWhere, indexWhere, indexWhere, iterator, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexWhere, lastIndexWhere, lastIndexWhere, length, toArray, toArray, toString, toString
void 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())
.MSeq<T> setAll(T value)
value
.value
- value
to fill this sequence with.this
array.MSeq<T> setAll(Iterator<? extends T> it)
it
- the iterator of the values to fill this sequence.this
sequence.MSeq<T> setAll(Iterable<? extends T> values)
values
- the values to fill this sequence.this
sequence.MSeq<T> setAll(T[] values)
values
- the first initial values of this sequencethis
sequence.MSeq<T> fill(Factory<? extends T> factory)
factory
- the value factory.this
sequence.NullPointerException
- if the given factory
is null
.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()
.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()
ListIterator<T> listIterator()
MSeq<T> subSeq(int start, int end)
Seq
start
, 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
sort 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)
Seq
start
, 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
sort 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)
Seq
map
in interface Seq<T>
B
- the element type of the returned collection.mapper
- the function to apply to each element.© 2007-2014 Franz Wilhelmstötter (2014-03-07 19:35)