|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pf.util.AssociationList<K,V>
public class AssociationList<K,V>
A container that holds a collection of Association objects. No null values are allowed. Neither for association keys nor for association values.
| Field Summary | |
|---|---|
static Association[] |
EMPTY_ASSOCIATION_ARRAY
|
| Constructor Summary | |
|---|---|
AssociationList()
Initialize the new instance with default values. |
|
AssociationList(java.util.Map<K,V> map)
Initialize the new instance with values from the given map. |
|
| Method Summary | |
|---|---|
void |
add(Association<K,V> association)
Adds the specified association. |
void |
add(K key,
V value)
Adds the specified key and value as new association. |
void |
addAll(Association<K,V>... associations)
Adds all association elements of the given array to the list. |
void |
addAll(java.util.Map<K,V> map)
Add all entries of the specified map as associations |
void |
addAll(java.util.Properties props)
Add all entries of the specified properties as associations |
java.util.Map<K,V> |
addAllToMap(java.util.Map<K,V> map)
Returns the given map object with all associations added to it. |
java.util.HashMap<K,V> |
asHashMap()
Returns all associations transformed to a HashMap where the association keys became the map keys and the association values became the map values. |
java.util.Hashtable<K,V> |
asHashtable()
Returns all associations transformed to a Hashtable where the association keys became the map keys and the association values became the map values. |
java.util.List<Association<K,V>> |
asList()
Returns all associations as list |
Association<K,V>[] |
associationArray()
Returns all associations as an array |
Association<K,V>[] |
associationArray(IObjectFilter filter)
Returns an array of all those elements contained in this list that match the given filter. |
Association<K,V> |
associationAt(int index)
Returns the association at the specified index. |
void |
clear()
Removes all association from the list. |
boolean |
containsKey(K key)
Returns true if the given key is in the list |
Association<K,V> |
findAssociation(K key)
Returns the association with the given key or null if the key can't be found. |
int |
indexOf(K key)
Returns the index of the given key or -1 if the key can't be found. |
boolean |
isEmpty()
Returns true if this list has no elements |
K |
keyAt(int index)
Returns the key of the association at the specified index. |
java.util.List<K> |
keys()
Returns all values that are currently stored (might contain duplicates) |
void |
processEach(IObjectProcessor associationProcessor)
Calls the given associationProcessor once for each association in this list. |
void |
put(Association<K,V> association)
Adds the specified association. |
void |
put(K key,
V value)
Puts the given value under the specified key. |
void |
putAll(Association<K,V>[] associations)
Adds all association elements of the given array to the list. |
void |
putAll(java.util.Map<K,V> map)
Puts all key-value pairs of the given map to the list. |
boolean |
remove(Association<K,V> association)
Removes the given association from this list. |
Association<K,V> |
remove(int index)
Removes the association at the given index. |
void |
removeAll(java.util.Collection<Association<K,V>> assocCollection)
Removes all association that are contained in the given collection. |
Association<K,V> |
removeKey(K key)
Removes the association with the given key. |
void |
setAssociationAt(int index,
Association<K,V> associaction)
Puts the given association at the specified index. |
int |
size()
Returns the number of associations in this list |
V |
valueAt(int index)
Returns the value of the association at the specified index. |
V |
valueAt(K key)
Returns the value associated with the specified key or null if the key cannot be found. |
java.util.List<V> |
values()
Returns all values that are currently stored (might contain duplicates) |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Association[] EMPTY_ASSOCIATION_ARRAY
| Constructor Detail |
|---|
public AssociationList()
public AssociationList(java.util.Map<K,V> map)
| Method Detail |
|---|
public void clear()
public int size()
public boolean isEmpty()
public void add(Association<K,V> association)
association - The association to add (must not be null!)
public void add(K key,
V value)
key - The key of the association to addvalue - The value of the association to addpublic void addAll(java.util.Map<K,V> map)
map - The map that contains all the key/value pairs to addpublic void addAll(java.util.Properties props)
props - The map that contains all the key/value pairs to addpublic void addAll(Association<K,V>... associations)
associations - The associations to addpublic Association<K,V>[] associationArray()
public Association<K,V>[] associationArray(IObjectFilter filter)
filter - The filter that determines which elements to return in the result array
public java.util.List<Association<K,V>> asList()
public java.util.Hashtable<K,V> asHashtable()
public java.util.HashMap<K,V> asHashMap()
public java.util.Map<K,V> addAllToMap(java.util.Map<K,V> map)
map - A valid map objectpublic void processEach(IObjectProcessor associationProcessor)
associationProcessor - The processor to be called for each associationpublic Association<K,V> associationAt(int index)
index - The index of the Association
public void setAssociationAt(int index,
Association<K,V> associaction)
index - The index of the association to setassociaction - The association to put at the given index
java.lang.IndexOutOfBoundsException - if the index is out of rangepublic K keyAt(int index)
index - The index of the Associationpublic V valueAt(int index)
index - The index of the Associationpublic V valueAt(K key)
key - The identifier for the desired valuepublic Association<K,V> findAssociation(K key)
key - The key to identify the associationpublic boolean remove(Association<K,V> association)
public Association<K,V> remove(int index)
public Association<K,V> removeKey(K key)
public void removeAll(java.util.Collection<Association<K,V>> assocCollection)
public java.util.List<V> values()
public java.util.List<K> keys()
public boolean containsKey(K key)
key - The key to look for
public void put(K key,
V value)
public void put(Association<K,V> association)
association - The association to add (must not be null!)public void putAll(Association<K,V>[] associations)
associations - The associations to addpublic void putAll(java.util.Map<K,V> map)
map - The associations to addpublic int indexOf(K key)
key - The key to look for
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||