|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jaggregate.AbstractCollection<E> jaggregate.AbstractExtensibleCollection<E>
E
- a restriction on the types of elements that may be included in the
collectionpublic abstract class AbstractExtensibleCollection<E>
Implementation of the extensible collection concept that should be common for most concrete implementations.
Method Summary | ||
---|---|---|
void |
addAll(Collection<? extends E> newElements)
Adds each element of the given collection to this collection. |
|
void |
addAll(E[] newElements)
|
|
void |
addAll(E newElement,
E... restOfNewElements)
|
|
void |
addAll(Iterable<? extends E> newElements)
|
|
|
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. 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. |
|
ExtensibleCollection<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 .
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. |
|
boolean |
removeAll(Collection<? extends E> oldElements)
For each element in the given collection, removes the first element from this collection which is equivalent to this element. |
|
boolean |
removeAll(E[] oldElements)
|
|
boolean |
removeAll(E oldElement,
E... restOfOldElements)
|
|
boolean |
removeAll(Iterable<? extends E> oldElements)
|
|
boolean |
removeIf(UnaryCondition<? super E> discriminator)
Removes each element of this collection which causes the given discriminator to answer true . |
|
boolean |
retainAll(Collection<? extends E> keepers)
Removes each element of this collection that is not contained in the given collection. |
|
boolean |
retainAll(E[] keepers)
|
|
boolean |
retainAll(E keeper,
E... restOfKeepers)
|
|
boolean |
retainAll(Iterable<? extends E> keepers)
|
|
boolean |
retainIf(UnaryCondition<? super E> discriminator)
Removes each element of this collection which causes the given discriminator to answer false . |
|
ExtensibleCollection<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 .
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. |
Methods inherited from class jaggregate.AbstractCollection |
---|
allSatisfy, anySatisfy, detect, includes, inject, isEmpty, occurrencesOf, rehash, toArray, toArray, toBag, toIdentityBag, toIdentitySet, toOrderedCollection, toSet, toSortedCollection, toSortedCollection |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface jaggregate.ExtensibleCollection |
---|
add, remove |
Methods inherited from interface jaggregate.Collection |
---|
allSatisfy, anySatisfy, detect, forEachDo, includes, inject, isEmpty, occurrencesOf, rehash, size, toArray, toArray, toBag, toIdentityBag, toIdentitySet, toOrderedCollection, toSet, toSortedCollection, toSortedCollection |
Method Detail |
---|
public <R> ExtensibleCollection<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 ExtensibleCollection<E>
collect
in class AbstractCollection<E>
R
- return type of the transformertransformer
- the transformer to evaluate
public ExtensibleCollection<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 ExtensibleCollection<E>
reject
in class AbstractCollection<E>
discriminator
- the discriminator to evaluate
public ExtensibleCollection<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 ExtensibleCollection<E>
select
in class AbstractCollection<E>
discriminator
- the discriminator to evaluate
public void addAll(Collection<? extends E> newElements)
newElements
to this
collection using add
with the element as the parameter.
The newElements
are traversed in the order specified by forEachDo
for newElements
.
addAll
in interface ExtensibleCollection<E>
newElements
- the elements to addpublic void addAll(E[] newElements)
addAll
in interface ExtensibleCollection<E>
newElements
- the elements to addExtensibleCollection.addAll(Collection)
public void addAll(E newElement, E... restOfNewElements)
addAll
in interface ExtensibleCollection<E>
newElement
- first new element to addrestOfNewElements
- remainder of the elements to addExtensibleCollection.addAll(Collection)
public void addAll(Iterable<? extends E> newElements)
addAll
in interface ExtensibleCollection<E>
newElements
- the elements to addExtensibleCollection.addAll(Collection)
public boolean removeAll(Collection<? extends E> oldElements)
oldElements
from this collection using remove
with the
element as the parameter.
removeAll
in interface ExtensibleCollection<E>
oldElements
- the elements to remove
true
if any removal occurredpublic boolean removeAll(E[] oldElements)
removeAll
in interface ExtensibleCollection<E>
oldElements
- the elements to remove
true
if any removal occurredExtensibleCollection.removeAll(Collection)
public boolean removeAll(E oldElement, E... restOfOldElements)
removeAll
in interface ExtensibleCollection<E>
oldElement
- first element to removerestOfOldElements
- remainder of the elements to remove
true
if any removal occurredExtensibleCollection.removeAll(Collection)
public boolean removeAll(Iterable<? extends E> oldElements)
removeAll
in interface ExtensibleCollection<E>
oldElements
- the elements to remove
true
if any removal occurredExtensibleCollection.removeAll(Collection)
public boolean removeIf(UnaryCondition<? super E> discriminator)
true
.
The elements are tested in the same order in which they would be enumerated by
forEachDo
for this collection.
removeIf
in interface ExtensibleCollection<E>
discriminator
- the discriminator to evaluate
true
if any removal occurredpublic boolean retainAll(Collection<? extends E> keepers)
retainAll
in interface ExtensibleCollection<E>
keepers
- the elements to retain
true
if any removal occurredpublic boolean retainAll(E[] keepers)
retainAll
in interface ExtensibleCollection<E>
keepers
- the elements to retain
true
if any removal occurredExtensibleCollection.retainAll(Collection)
public boolean retainAll(E keeper, E... restOfKeepers)
retainAll
in interface ExtensibleCollection<E>
keeper
- first element to retainrestOfKeepers
- remainder of the elements to retain
true
if any removal occurredExtensibleCollection.retainAll(Collection)
public boolean retainAll(Iterable<? extends E> keepers)
retainAll
in interface ExtensibleCollection<E>
keepers
- the elements to retain
true
if any removal occurredExtensibleCollection.retainAll(Collection)
public boolean retainIf(UnaryCondition<? super E> discriminator)
false
.
The elements are tested in the same order in which they would be enumerated by
forEachDo
for this collection.
retainIf
in interface ExtensibleCollection<E>
discriminator
- the discriminator to evaluate
true
if any removal occurred
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |