|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pf.util.AssociationList<java.lang.String,V>
org.pf.util.NamedValueList<V>
public class NamedValueList<V>
A container that holds a collection of NamedValue objects.
| Field Summary | |
|---|---|
static NamedValue[] |
EMPTY_NAMED_VALUE_ARRAY
|
| Fields inherited from class org.pf.util.AssociationList |
|---|
EMPTY_ASSOCIATION_ARRAY |
| Constructor Summary | |
|---|---|
NamedValueList()
Initialize the new instance with default values. |
|
NamedValueList(java.util.Map<java.lang.String,V> map)
Initialize the new instance with values from the given map. |
|
| Method Summary | |
|---|---|
void |
add(Association<java.lang.String,V> association)
Adds the specified association only if it is an instance of NamedValue. |
void |
add(NamedValue<V> namedValue)
Adds the specified named value. |
void |
add(java.lang.String name,
V value)
Adds the specified name and value as new NamedValue. |
void |
addAll(NamedValue<V>... namedValues)
Adds all named value elements of the given array to the list. |
boolean |
containsName(java.lang.String name)
Returns true if this list contains an entry with the given name (case-sensitive) |
NamedValue<V> |
findNamedValue(java.lang.String name)
Returns the first named value with the specified name or null if none can be found. |
java.lang.String |
nameAt(int index)
Returns the name (key) of the named value at the specified index. |
NamedValue<V>[] |
namedValueArray()
Returns all named values as an array |
NamedValue<V>[] |
namedValueArray(IObjectFilter filter)
Returns an array of all those elements contained in this list that match the given filter. |
NamedValue<V> |
namedValueAt(int index)
Returns the named value at the specified index. |
java.util.List<java.lang.String> |
names()
Returns all names in this list |
NamedValue<V> |
remove(java.lang.String name)
Remove the NamedValue identified by the given name. |
void |
setNamedValueAt(int index,
NamedValue<V> namedValue)
Puts the given named value at the specified index. |
void |
sort()
Sorts the elements in this list by name in ascending order. |
void |
sort(boolean ascending)
Sorts the elements in this list by name. |
V |
valueAt(java.lang.String name)
Returns the value associated with the specified name or null if the name cannot be found. |
| Methods inherited from class org.pf.util.AssociationList |
|---|
addAll, addAll, addAll, addAllToMap, asHashMap, asHashtable, asList, associationArray, associationArray, associationAt, clear, containsKey, findAssociation, indexOf, isEmpty, keyAt, keys, processEach, put, put, putAll, putAll, remove, remove, removeAll, removeKey, setAssociationAt, size, valueAt, values |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final NamedValue[] EMPTY_NAMED_VALUE_ARRAY
| Constructor Detail |
|---|
public NamedValueList()
public NamedValueList(java.util.Map<java.lang.String,V> map)
| Method Detail |
|---|
public void add(NamedValue<V> namedValue)
namedValue - The named value to add (must not be null!)public void add(Association<java.lang.String,V> association)
add in class AssociationList<java.lang.String,V>association - The association to add (must not be null!)
public void add(java.lang.String name,
V value)
add in class AssociationList<java.lang.String,V>name - The name of the named value to addvalue - The value of the named value to addpublic void addAll(NamedValue<V>... namedValues)
namedValues - The values to addpublic NamedValue<V>[] namedValueArray()
public NamedValue<V>[] namedValueArray(IObjectFilter filter)
filter - The filter that determines which elements to return in the result array
public NamedValue<V> namedValueAt(int index)
index - The index of the NamedValue
public void setNamedValueAt(int index,
NamedValue<V> namedValue)
index - The index where to put the namedValuenamedValue - The named value object to be put at the given index
java.lang.IndexOutOfBoundsException - if the index is out of rangepublic java.lang.String nameAt(int index)
index - The index of the NamedValuepublic NamedValue<V> findNamedValue(java.lang.String name)
name - The name of the named value to look forpublic boolean containsName(java.lang.String name)
public void sort()
public void sort(boolean ascending)
ascending - If true, elements will be sorted in ascending order. Otherwise in descending order.public V valueAt(java.lang.String name)
valueAt in class AssociationList<java.lang.String,V>name - The identifier for the desired valuepublic NamedValue<V> remove(java.lang.String name)
public java.util.List<java.lang.String> names()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||