|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
K
- a restriction on the types of the keys that may be contained in the
dictionaryV
- a restriction on the types of the values that may be contained in the
dictionarypublic interface AbstractDictionary<K,V>
Provides protocol for accessing, adding, removing, and iterating over the elements of an unordered collection whose elements are accessed using an explicitly assigned external key.
Method Summary | ||
---|---|---|
V |
at(K key)
Answers the element associated with the given key in this dictionary. |
|
|
collect(UnaryFunctor<? super Pair<K,V>,? 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. |
|
|
collectValues(UnaryFunctor<? super V,? extends R> transformer)
Answers a new dictionary whose keys are this dictionary's keys, and whose corresponding elements are the results of evaluating the given transformer with each corresponding element of this dictionary. |
|
boolean |
includesKey(K key)
Answers true if this dictionary contains an element stored at the given
key, else answers false . |
|
K |
keyAt(V value)
Answers a key such that the element associated with this key is equivalent to the given value. |
|
AbstractSet<K> |
keys()
Answers a set of keys at which there is an element stored in this dictionary. |
|
void |
keysAndValuesDo(BinaryFunctor<? super K,? super V,?> operation)
Iteratively evaluates the given operation with each of this dictionary's keys and values. |
|
|
keysDo(UnaryFunctor<? super K,? extends R> operation)
Iteratively evaluates the given operation with each of this dictionary's keys at which there are elements stored. |
|
void |
putAll(AbstractDictionary<? extends K,? extends V> newPairs)
Stores the elements of the given dictionary in this dictionary at the corresponding key from the given dictionary. |
|
V |
putAt(K key,
V newElement)
Stores a new element at a given key in this dictionary. |
|
AbstractDictionary<K,V> |
reject(UnaryCondition<? super Pair<K,V>> discriminator)
Answers a new collection which contains only the elements in this collection which cause the given discriminator to answer false . |
|
AbstractDictionary<K,V> |
rejectValues(UnaryCondition<? super V> discriminator)
Answers a new dictionary which excludes the elements in this dictionary that cause the given discriminator to answer true . |
|
void |
removeAllKeys(Collection<? extends K> oldKeys)
Removes any elements from this dictionary which are stored at any of the given keys. |
|
void |
removeAllKeys(Iterable<? extends K> oldKeys)
|
|
void |
removeAllKeys(K[] oldKeys)
|
|
void |
removeAllKeys(K oldKey,
K... restOfOldKeys)
|
|
boolean |
removeIfKey(UnaryCondition<? super K> discriminator)
Removes each element of this dictionary whose key causes the given discriminator to answer true . |
|
boolean |
removeIfValue(UnaryCondition<? super V> discriminator)
Removes each element of this dictionary which causes the given discriminator to answer true . |
|
V |
removeKey(K key)
Removes the element stored at the given key in this dictionary. |
|
boolean |
retainAllKeys(Collection<? extends K> keepers)
Removes any elements from this dictionary which are not stored at any of the given keys. |
|
boolean |
retainAllKeys(Iterable<? extends K> keepers)
|
|
boolean |
retainAllKeys(K[] keepers)
|
|
boolean |
retainAllKeys(K keeper,
K... restOfKeepers)
|
|
boolean |
retainIfKey(UnaryCondition<? super K> discriminator)
Removes each element of this dictionary whose key causes the given discriminator to answer false . |
|
boolean |
retainIfValue(UnaryCondition<? super V> discriminator)
Removes each element of this dictionary which causes the given discriminator to answer false . |
|
AbstractDictionary<K,V> |
select(UnaryCondition<? super Pair<K,V>> discriminator)
Answers a new collection which contains only the elements in this collection which cause the given discriminator to answer true . |
|
AbstractDictionary<K,V> |
selectValues(UnaryCondition<? super V> discriminator)
Answers a new dictionary which contains the elements in this dictionary whose keys cause the given discriminator to answer true . |
|
AbstractBag<V> |
values()
Answers a collection of this dictionary's elements. |
Methods inherited from interface jaggregate.ExtensibleCollection |
---|
add, addAll, addAll, addAll, addAll, remove, removeAll, removeAll, removeAll, removeAll, removeIf, retainAll, retainAll, retainAll, retainAll, retainIf |
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 |
---|
<R> AbstractBag<R> collect(UnaryFunctor<? super Pair<K,V>,? 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<Pair<K,V>>
collect
in interface ExtensibleCollection<Pair<K,V>>
R
- return type of the transformertransformer
- the transformer to evaluate
AbstractDictionary<K,V> reject(UnaryCondition<? super Pair<K,V>> 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<Pair<K,V>>
reject
in interface ExtensibleCollection<Pair<K,V>>
discriminator
- the discriminator to evaluate
AbstractDictionary<K,V> select(UnaryCondition<? super Pair<K,V>> 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<Pair<K,V>>
select
in interface ExtensibleCollection<Pair<K,V>>
discriminator
- the discriminator to evaluate
V at(K key)
key
- the key to look up
null
if there is no such element<R> AbstractDictionary<K,R> collectValues(UnaryFunctor<? super V,? extends R> transformer)
transformer
with the
corresponding element of this dictionary as a parameter.
The elements are traversed in the order specified by forEachDo
for this dictionary.
R
- return type of the transformertransformer
- the transformer to evaluate
transformer
with the elements of this
dictionary
NullPointerException
- if transformer
is null
boolean includesKey(K key)
true
if this dictionary contains an element stored at the given
key, else answers false
.
key
- the key to lookup
K keyAt(V value)
value
- the value to look up
null
if there is no such keyAbstractSet<K> keys()
void keysAndValuesDo(BinaryFunctor<? super K,? super V,?> operation)
operation
is evaluated with the
corresponding key as the first argument and the element as the second argument.
The order in which the elements are visited is not specified. Each key is visited
exactly once.
operation
- the operation to perform
NullPointerException
- if operation
is null
<R> void keysDo(UnaryFunctor<? super K,? extends R> operation)
operation
is evaluated with the
corresponding key as the argument.
The order in which the elements are visited is not specified. Each key is visited
exactly once.
R
- a constraint on the return type of the operationoperation
- the operation to perform
NullPointerException
- if operation
is null
void putAll(AbstractDictionary<? extends K,? extends V> newPairs)
putAt
on this dictionary with each of the keys and elements from newPairs
in turn. If a key in newPairs
is key-equivalent to a key in
this dictionary, the associated element in newPairs
replaces the element
in this dictionary.
newPairs
- the pairs to add
NullPointerException
- if newPairs
is null
V putAt(K key, V newElement)
key
, then newElement
replaces the element
previously stored at key
. Otherwise, newElement
is stored at the
new key
. In either case, subsequent successful lookups for key
will answer newElement
.
key
- a keynewElement
- the new element to associate with key
key
, or null
if
there is no such elementAbstractDictionary<K,V> rejectValues(UnaryCondition<? super V> discriminator)
true
.
For each of this dictionary's keys, discriminator
is evaluated with the
corresponding element as the argument. If the element causes discriminator
to answer false
, the key is added to the answer with the element as its
corresponding value.
discriminator
- the discriminator to evaluate
NullPointerException
- if discriminator
is null
void removeAllKeys(Collection<? extends K> oldKeys)
removeKey
on this dictionary for each element in
oldKeys
.
oldKeys
- the keys to remove
NullPointerException
- if oldKeys
is null
void removeAllKeys(K[] oldKeys)
oldKeys
- the keys to remove
NullPointerException
- if restOfOldKeys
is null
removeAllKeys(Collection)
void removeAllKeys(K oldKey, K... restOfOldKeys)
oldKey
- the first key to removerestOfOldKeys
- the remainder of keys to remove
NullPointerException
- if restOfOldKeys
is null
removeAllKeys(Collection)
void removeAllKeys(Iterable<? extends K> oldKeys)
oldKeys
- the keys to remove
NullPointerException
- if oldKeys
is null
removeAllKeys(Collection)
V removeKey(K key)
key
- the key to remove
null
if there is no such elementboolean removeIfKey(UnaryCondition<? super K> discriminator)
true
.
discriminator
- the discriminator to evaluate
true
if any removal occurred
NullPointerException
- if discriminator
is null
boolean removeIfValue(UnaryCondition<? super V> discriminator)
true
.
discriminator
- the discriminator to evaluate
true
if any removal occurred
NullPointerException
- if discriminator
is null
boolean retainAllKeys(Collection<? extends K> keepers)
keepers
- the keys to retain
true
if any elements were removed from this dictionary
NullPointerException
- if keepers
is null
boolean retainAllKeys(K[] keepers)
keepers
- the keys to retain
true
if any elements were removed from this dictionary
NullPointerException
- if keepers
is null
retainAllKeys(Collection)
boolean retainAllKeys(K keeper, K... restOfKeepers)
keeper
- the first key to retainrestOfKeepers
- the remainder of keys to retain
true
if any elements were removed from this dictionary
NullPointerException
- if restOfKeepers
is null
retainAllKeys(Collection)
boolean retainAllKeys(Iterable<? extends K> keepers)
keepers
- the keys to retain
true
if any elements were removed from this dictionary
NullPointerException
- if keepers
is null
retainAllKeys(Collection)
boolean retainIfKey(UnaryCondition<? super K> discriminator)
false
.
discriminator
- the discriminator to evaluate
true
if any removal occurred
NullPointerException
- if discriminator
is null
boolean retainIfValue(UnaryCondition<? super V> discriminator)
false
.
discriminator
- the discriminator to evaluate
true
if any removal occurred
NullPointerException
- if discriminator
is null
AbstractDictionary<K,V> selectValues(UnaryCondition<? super V> discriminator)
true
.
For each of this dictionary's keys, discriminator
is evaluated with the
corresponding element as the argument. If the element causes discriminator
to answer true
, the key is added to the answer with the element as
its corresponding value.
discriminator
- the discriminator to evaluate
NullPointerException
- if discriminator
is null
AbstractBag<V> values()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |