|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
E
- a restriction on the types of elements that may be included in the
sequencepublic interface Sequence<E>
Provides protocol for writing to an ordered collection of objects whose elements can be accessed using external integer keys.
Method Summary | ||
---|---|---|
|
collect(UnaryFunctor<? super E,? extends R> transformer)
Evaluates the given transformer for each element of this collection, with the element as the parameter, and answers a new collection containing the results of these evaluations. |
|
Sequence<E> |
concat(ReadOnlySequence<? extends E> otherSequence)
Answers a new sequence containing all of this sequence's elements in their original order followed by all of the elements of the given sequence, in their original order. |
|
Sequence<E> |
copyRange(int start,
int stop)
Answers a new sequence containing the specified range of elements of this sequence in their original order. |
|
Sequence<E> |
copyWith(E newElement)
Answers a new sequence with size one greater than the size of this sequence, containing the elements of this sequence and a given new element placed at the end. |
|
Sequence<E> |
copyWithout(E oldElement)
Answers a new sequence with all of the elements of this sequence that are not equivalent to the given element, in their original order. |
|
E |
putAt(int index,
E newElement)
Replaces the element in this sequence at a given index with a new element. |
|
void |
putAtAll(Collection<? extends Integer> indices,
E newElement)
Replaces the elements in this sequence specified by the given indices with a new element. |
|
void |
putAtAll(E newElement)
Replaces all the elements in this sequence with a new element. |
|
void |
putAtAll(int[] indices,
E newElement)
|
|
void |
putAtAll(Integer[] indices,
E newElement)
|
|
void |
putAtAll(Iterable<? extends Integer> indices,
E newElement)
|
|
Sequence<E> |
reject(UnaryCondition<? super E> discriminator)
Answers a new collection which contains only the elements in this collection which cause the given discriminator to answer false . |
|
void |
replace(int start,
int stop,
E replacement)
Replaces the elements of this sequence between two positions, inclusive, with a given element. |
|
void |
replaceRange(int start,
int stop,
ReadOnlySequence<? extends E> replacements)
Replaces the elements of this sequence between two positions, inclusive, with a given replacement sequence in their original order. |
|
void |
replaceRange(int start,
int stop,
ReadOnlySequence<? extends E> replacements,
int replacementStart)
Replaces the elements of this sequence between two positions, inclusive, with a given replacement sequence, in their original order, starting at a given position in the replacement sequence. |
|
Sequence<E> |
reverse()
Answers a sequence with the elements of this sequence arranged in reverse order. |
|
Sequence<E> |
select(UnaryCondition<? super E> discriminator)
Answers a new collection which contains only the elements in this collection which cause the given discriminator to answer true . |
Methods inherited from interface jaggregate.ReadOnlySequence |
---|
after, at, before, doWithIndex, doWithOthers, findFirst, findLast, first, forEachDo, forEachInRangeDo, forEachInRangeDoWithIndex, forEachInReverseDo, indexOf, indexOf, last |
Methods inherited from interface jaggregate.Collection |
---|
allSatisfy, anySatisfy, detect, includes, inject, isEmpty, occurrencesOf, rehash, size, toArray, toArray, toBag, toIdentityBag, toIdentitySet, toOrderedCollection, toSet, toSortedCollection, toSortedCollection |
Method Detail |
---|
<R> Sequence<R> collect(UnaryFunctor<? super E,? extends R> transformer)
forEachDo
for this collection.
Unless specifically refined, this message is defined to answer an object
conforming to the same protocol as this collection.
collect
in interface Collection<E>
collect
in interface ReadOnlySequence<E>
R
- return type of the transformertransformer
- the transformer to evaluate
Sequence<E> reject(UnaryCondition<? super E> discriminator)
false
.
For each element of this collection, discriminator
is evaluated with the
element as the parameter. Each element which causes discriminator
to
answer false
is included in the new collection.
The elements are traversed in the order specified by forEachDo
for this collection.
Unless specifically refined, this message is defined to answer an object
conforming to the same protocol as this collection. If both this collection
and the result maintain an ordering of their elements, the elements of the
result will be in the same relative order as the elements of this collection.
reject
in interface Collection<E>
reject
in interface ReadOnlySequence<E>
discriminator
- the discriminator to evaluate
Sequence<E> select(UnaryCondition<? super E> discriminator)
true
.
For each element of this collection, discriminator
is evaluated with the
element as the parameter. Each element which causes discriminator
to
answer true
is included in the new collection.
The elements are traversed in order specified by forEachDo
for this collection.
Unless specifically refined, this message is defined to answer an object
conforming to the same protocol as this collection. If both this collection
and the result maintain an ordering of their elements, the elements of the
result will be in the same relative order as the elements of this collection.
select
in interface Collection<E>
select
in interface ReadOnlySequence<E>
discriminator
- the discriminator to evaluate
Sequence<E> concat(ReadOnlySequence<? extends E> otherSequence)
otherSequence
.
Sequences that enforce an ordering on their elements are permitted to refine
this message to reorder the result.
concat
in interface ReadOnlySequence<E>
otherSequence
- the sequence to concatenate
Sequence<E> copyRange(int start, int stop)
start
in this
sequence is at index 0
in the new sequence; the element at
start + 1
is at index 1
, etc. If stop < start
, then the
new sequence is empty. Otherwise, the size of the new sequence is max(0, stop - start)
.
The given indices must be non-negative.
copyRange
in interface ReadOnlySequence<E>
start
- the beginning indexstop
- the ending index
Sequence<E> copyWith(E newElement)
copyWith
in interface ReadOnlySequence<E>
newElement
- element to add to the copy
newElement
appendedSequence<E> copyWithout(E oldElement)
copyWithout
in interface ReadOnlySequence<E>
oldElement
- the element to strip from the copy of this sequence
oldElement
removedSequence<E> reverse()
forEachInReverseDo
message,
adding each element of this sequence to the new sequence.
reverse
in interface ReadOnlySequence<E>
E putAt(int index, E newElement)
index
- the index at which to replace the elementnewElement
- the element to place at index
index
, or null
if there is
no such element
IndexOutOfBoundsException
- if index < 0
or index >=
this
sequence's sizevoid putAtAll(Collection<? extends Integer> indices, E newElement)
newElement
in this sequence at
each index specified by indices
using putAt
.
indices
- the indices at which to replace elementsnewElement
- the element to place at each of the indices
NullPointerException
- if indices
or any of its elements is
null
IndexOutOfBoundsException
- if any element of indices
is
< 0
or >=
this sequence's sizevoid putAtAll(int[] indices, E newElement)
indices
- the indices at which to replace elementsnewElement
- the element to place at each of the indices
NullPointerException
- if indices
or any of its elements is
null
IndexOutOfBoundsException
- if any element of indices
is
< 0
or >=
this sequence's sizeputAtAll(Collection,Object)
void putAtAll(Integer[] indices, E newElement)
indices
- the indices at which to replace elementsnewElement
- the element to place at each of the indices
NullPointerException
- if indices
or any of its elements is
null
IndexOutOfBoundsException
- if any element of indices
is
< 0
or >=
this sequence's sizeputAtAll(Collection,Object)
void putAtAll(Iterable<? extends Integer> indices, E newElement)
indices
- the indices at which to replace elementsnewElement
- the element to place at each of the indices
NullPointerException
- if indices
or any of its elements is
null
IndexOutOfBoundsException
- if any element of indices
is
< 0
or >=
this sequence's sizeputAtAll(Collection,Object)
void putAtAll(E newElement)
newElement
in this sequence at each
index from 0
to this sequence's size minus 1 using
putAt
.
newElement
- the element to place at each indexvoid replace(int start, int stop, E replacement)
start
- beginning indexstop
- ending indexreplacement
- element with which to replace the elements between
start
and stop
, inclusive
IndexOutOfBoundsException
- if either start
or stop
is
< 0
or >=
this sequence's sizevoid replaceRange(int start, int stop, ReadOnlySequence<? extends E> replacements)
replacements
is stored in this sequence at position
start
, the second at position start + 1
, etc. Any previously
stored elements at these positions are replaced.
start
- beginning indexstop
- ending indexreplacements
- elements to replace in between start
and
stop
, inclusive
NullPointerException
- if replacements
is null
IndexOutOfBoundsException
- if either start
or stop
is
< 0
or >=
this sequence's size
IllegalArgumentException
- if the size of
replacements
is not equal to stop - start + 1
void replaceRange(int start, int stop, ReadOnlySequence<? extends E> replacements, int replacementStart)
replacementStart
in replacements
is stored in this sequence at position start
; the element at
replacementStart + 1
is stored at position start + 1
; etc.
Any previously stored elements at these positions are replaced.
start
- beginning indexstop
- ending indexreplacements
- elements to replace in between start
and
stop
, inclusivereplacementStart
- index to start at in replacements
NullPointerException
- if replacements
is null
IndexOutOfBoundsException
- if either start
or stop
is
< 0
or >=
this sequence's size, or if
replacementStart
is < 0
or >=
replacements
's
size
IllegalArgumentException
- if the size of
replacements
is not equal to replacementStart + stop - start
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |