|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractList<E> java.util.ArrayList<Pair<K,V>> org.springframework.shell.support.util.PairList<K,V>
K
- the type of keyV
- the type of valuepublic class PairList<K,V>
A List
of Pair
s. Unlike a Map
, it can have
duplicate and/or null
keys.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
PairList()
Constructor for an empty list of pairs |
|
PairList(List<? extends K> keys,
List<? extends V> values)
Constructor for building a list of the given key-value pairs |
|
PairList(Pair<K,V>... pairs)
Returns the given array of pairs as a modifiable list |
Method Summary | |
---|---|
boolean |
add(K key,
V value)
Adds a new pair to this list with the given key and value |
List<K> |
getKeys()
Returns the keys of each Pair in this list |
List<V> |
getValues()
Returns the values of each Pair in this list |
Pair<K,V>[] |
toArray()
|
Methods inherited from class java.util.ArrayList |
---|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
equals, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, removeAll, retainAll, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList |
Constructor Detail |
---|
public PairList(Pair<K,V>... pairs)
K
- the type of keyV
- the type of valuepairs
- the pairs to put in a listpublic PairList(List<? extends K> keys, List<? extends V> values)
keys
- the keys (can be null)values
- the values (must be null if the keys are null, otherwise
must be non-null and of the same size as the keys)public PairList()
Method Detail |
---|
public List<K> getKeys()
Pair
in this list
null
listpublic List<V> getValues()
Pair
in this list
null
modifiable copy of this listpublic boolean add(K key, V value)
key
- the key to add; can be null
value
- the value to add; can be null
public Pair<K,V>[] toArray()
toArray
in interface Collection<Pair<K,V>>
toArray
in interface List<Pair<K,V>>
toArray
in class ArrayList<Pair<K,V>>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |