|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groiss.ds.KeyedList<K,V>
public class KeyedList<K,V>
This class implements an ordered map. A list of keys is mapped to a list of values. The values can be accessed by the key or the position in the list.
| Constructor Summary | |
|---|---|
KeyedList()
|
|
KeyedList(List<K> keys,
List<V> content)
Create a new KeyedList. |
|
| Method Summary | ||
|---|---|---|
void |
add(int pos,
V o)
|
|
boolean |
add(V o)
|
|
boolean |
addAll(Collection<? extends V> c)
|
|
boolean |
addAll(int i,
Collection<? extends V> c)
|
|
void |
clear()
|
|
boolean |
contains(Object o)
|
|
boolean |
containsAll(Collection<?> c)
|
|
V |
get(int pos)
|
|
V |
get(Object key)
Get the object mapped to the given key. |
|
K |
getKey(int i)
Returns the key a postion i |
|
int |
getKey(Object key)
Return the position of the given key in the key list. |
|
Iterator<K> |
getKeyIterator()
Returns an iterator for the key list |
|
int |
indexOf(Object o)
|
|
boolean |
isEmpty()
|
|
Iterator<V> |
iterator()
|
|
int |
lastIndexOf(Object o)
|
|
ListIterator<V> |
listIterator()
|
|
ListIterator<V> |
listIterator(int i)
|
|
void |
put(int pos,
K key,
V elem)
Put an element at position. |
|
void |
put(K key,
V elem)
Put an element to the end of the list. |
|
V |
remove(int pos)
|
|
boolean |
remove(Object o)
|
|
boolean |
removeAll(Collection<?> c)
|
|
boolean |
removeKey(Object key)
Removes the key (and associated object) from the list |
|
boolean |
retainAll(Collection<?> c)
|
|
V |
set(int i,
V o)
|
|
void |
set(K key,
V elem)
Replace the element mapped to key with the given element. |
|
int |
size()
|
|
List<V> |
subList(int fromIndex,
int toIndex)
|
|
Object[] |
toArray()
|
|
|
toArray(T[] a)
|
|
List<V> |
values()
Return the content list. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public KeyedList()
public KeyedList(List<K> keys,
List<V> content)
keys - content - | Method Detail |
|---|
public void put(K key,
V elem)
key - a keyelem - an element
public void put(int pos,
K key,
V elem)
pos - insert after this positionkey - a keyelem - an elementpublic V get(Object key)
key -
public void set(K key,
V elem)
key - elem - public List<V> values()
public K getKey(int i)
i - the position
public Iterator<K> getKeyIterator()
public int getKey(Object key)
key -
public boolean removeKey(Object key)
key -
public int size()
size in interface Collection<V>size in interface List<V>public void clear()
clear in interface Collection<V>clear in interface List<V>public boolean isEmpty()
isEmpty in interface Collection<V>isEmpty in interface List<V>public Object[] toArray()
toArray in interface Collection<V>toArray in interface List<V>public V get(int pos)
get in interface List<V>public V remove(int pos)
remove in interface List<V>
public void add(int pos,
V o)
add in interface List<V>public int indexOf(Object o)
indexOf in interface List<V>public int lastIndexOf(Object o)
lastIndexOf in interface List<V>public boolean add(V o)
add in interface Collection<V>add in interface List<V>public boolean contains(Object o)
contains in interface Collection<V>contains in interface List<V>public boolean remove(Object o)
remove in interface Collection<V>remove in interface List<V>
public boolean addAll(int i,
Collection<? extends V> c)
addAll in interface List<V>public boolean addAll(Collection<? extends V> c)
addAll in interface Collection<V>addAll in interface List<V>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<V>containsAll in interface List<V>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<V>removeAll in interface List<V>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<V>retainAll in interface List<V>public Iterator<V> iterator()
iterator in interface Iterable<V>iterator in interface Collection<V>iterator in interface List<V>
public List<V> subList(int fromIndex,
int toIndex)
subList in interface List<V>public ListIterator<V> listIterator()
listIterator in interface List<V>public ListIterator<V> listIterator(int i)
listIterator in interface List<V>
public V set(int i,
V o)
set in interface List<V>public <T> T[] toArray(T[] a)
toArray in interface Collection<V>toArray in interface List<V>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||