|
||||||||||
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> jaggregate.AbstractSet<E> jaggregate.IdentitySet<E>
E
- a restriction on the types of elements that may be included in the setpublic class IdentitySet<E>
A set for which equivalence is defined by ==
.
Constructor Summary | |
---|---|
IdentitySet()
Creates an empty set. |
|
IdentitySet(Collection<? extends E> elements)
Creates a set containing the elements in the given collection. |
|
IdentitySet(E... elements)
Creates a set containing the elements in the given array. |
|
IdentitySet(Iterable<? extends E> elements)
Creates a set containing the elements in the given iterable object. |
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. 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. |
|
static
|
emptyIdentitySet()
Creates an empty set. |
|
static
|
identitySetFrom(Collection<? extends T> elements)
Creates a set containing the elements in the given collection. |
|
static
|
identitySetFrom(Iterable<? extends T> elements)
Creates a set containing the elements given by an iterable object. |
|
static
|
identitySetFrom(T[] elements)
Creates a set containing the elements in the given array. |
|
static
|
identitySetWith(T newElement,
T... restOfNewElements)
Creates a set containing the given elements. |
|
IdentitySet<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. |
|
IdentitySet<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. |
|
IdentitySet<E> |
toIdentitySet()
Answers an identity set with the same elements as this collection. Since sets do not store duplicate elements, the result may have fewer elements than this collection. Answers self. |
Methods inherited from class jaggregate.AbstractSet |
---|
add, equals, forEachDo, hashCode, includes, occurrencesOf, rehash, remove, size, toString |
Methods inherited from class jaggregate.AbstractExtensibleCollection |
---|
addAll, addAll, addAll, addAll, removeAll, removeAll, removeAll, removeAll, removeIf, retainAll, retainAll, retainAll, retainAll, retainIf |
Methods inherited from class jaggregate.AbstractCollection |
---|
allSatisfy, anySatisfy, detect, inject, isEmpty, toArray, toArray, toBag, toIdentityBag, toOrderedCollection, toSet, toSortedCollection, toSortedCollection |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface jaggregate.Collection |
---|
allSatisfy, anySatisfy, detect, inject, isEmpty, toArray, toArray, toBag, toIdentityBag, toOrderedCollection, toSet, toSortedCollection, toSortedCollection |
Constructor Detail |
---|
public IdentitySet()
public IdentitySet(Collection<? extends E> elements)
elements
- elements to add to the new set
NullPointerException
- if elements
is null
public IdentitySet(E... elements)
elements
- elements to add to the new set
NullPointerException
- if elements
is null
public IdentitySet(Iterable<? extends E> elements)
elements
- elements to add to the new set
NullPointerException
- if elements
is null
Method Detail |
---|
public static <T> IdentitySet<T> emptyIdentitySet()
T
- the type of elements allowed in the new set
public static <T> IdentitySet<T> identitySetFrom(Collection<? extends T> elements)
T
- the type of elements allowed in the new setelements
- elements to add to the new set
NullPointerException
- if elements
is null
public static <T> IdentitySet<T> identitySetFrom(T[] elements)
T
- the type of elements allowed in the new setelements
- elements to add to the new set
NullPointerException
- if elements
is null
public static <T> IdentitySet<T> identitySetWith(T newElement, T... restOfNewElements)
T
- the type of elements allowed in the new setnewElement
- first new element to addrestOfNewElements
- remainder of the elements to add
NullPointerException
- if restOfNewElements
is null
IllegalArgumentException
- if any of the new elements is found to violate
restrictions on the characteristics of valid elementsAbstractExtensibleCollection.addAll(Collection)
public static <T> IdentitySet<T> identitySetFrom(Iterable<? extends T> elements)
T
- the type of elements allowed in the new setelements
- elements to add to the new set
NullPointerException
- if elements
is null
public IdentitySet<E> toIdentitySet()
toIdentitySet
in interface Collection<E>
toIdentitySet
in class AbstractCollection<E>
public <R> IdentitySet<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 AbstractSet<E>
R
- return type of the transformertransformer
- the transformer to evaluate
public IdentitySet<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 AbstractSet<E>
discriminator
- the discriminator to evaluate
public IdentitySet<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 AbstractSet<E>
discriminator
- the discriminator to evaluate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |