|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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(java.util.List<K> keys,
java.util.List<V> content)
Create a new KeyedList. |
Method Summary | ||
---|---|---|
void |
add(int pos,
V o)
|
|
boolean |
add(V o)
|
|
boolean |
addAll(java.util.Collection<? extends V> c)
|
|
boolean |
addAll(int i,
java.util.Collection<? extends V> c)
|
|
void |
clear()
|
|
boolean |
contains(java.lang.Object o)
|
|
boolean |
containsAll(java.util.Collection<?> c)
|
|
V |
get(int pos)
|
|
V |
get(java.lang.Object key)
Get the object mapped to the given key. |
|
K |
getKey(int i)
Returns the key a postion i |
|
int |
getKey(java.lang.Object key)
Return the position of the given key in the key list. |
|
java.util.Iterator<K> |
getKeyIterator()
Returns an iterator for the key list |
|
int |
indexOf(java.lang.Object o)
|
|
boolean |
isEmpty()
|
|
java.util.Iterator<V> |
iterator()
|
|
int |
lastIndexOf(java.lang.Object o)
|
|
java.util.ListIterator<V> |
listIterator()
|
|
java.util.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(java.lang.Object o)
|
|
boolean |
removeAll(java.util.Collection<?> c)
|
|
boolean |
removeKey(java.lang.Object key)
Removes the key (and associated object) from the list |
|
boolean |
retainAll(java.util.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()
|
|
java.util.List<V> |
subList(int fromIndex,
int toIndex)
|
|
java.lang.Object[] |
toArray()
|
|
|
toArray(T[] a)
|
|
java.util.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(java.util.List<K> keys, java.util.List<V> content)
keys
- content
- Method Detail |
---|
public void put(K key, V elem)
key
- a keyelem
- an elementpublic void put(int pos, K key, V elem)
pos
- insert after this positionkey
- a keyelem
- an elementpublic V get(java.lang.Object key)
key
-
public void set(K key, V elem)
key
- elem
- public java.util.List<V> values()
public K getKey(int i)
i
- the position
public java.util.Iterator<K> getKeyIterator()
public int getKey(java.lang.Object key)
key
-
public boolean removeKey(java.lang.Object key)
key
-
public int size()
size
in interface java.util.Collection<V>
size
in interface java.util.List<V>
public void clear()
clear
in interface java.util.Collection<V>
clear
in interface java.util.List<V>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<V>
isEmpty
in interface java.util.List<V>
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<V>
toArray
in interface java.util.List<V>
public V get(int pos)
get
in interface java.util.List<V>
public V remove(int pos)
remove
in interface java.util.List<V>
public void add(int pos, V o)
add
in interface java.util.List<V>
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<V>
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<V>
public boolean add(V o)
add
in interface java.util.Collection<V>
add
in interface java.util.List<V>
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<V>
contains
in interface java.util.List<V>
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<V>
remove
in interface java.util.List<V>
public boolean addAll(int i, java.util.Collection<? extends V> c)
addAll
in interface java.util.List<V>
public boolean addAll(java.util.Collection<? extends V> c)
addAll
in interface java.util.Collection<V>
addAll
in interface java.util.List<V>
public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<V>
containsAll
in interface java.util.List<V>
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<V>
removeAll
in interface java.util.List<V>
public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<V>
retainAll
in interface java.util.List<V>
public java.util.Iterator<V> iterator()
iterator
in interface java.lang.Iterable<V>
iterator
in interface java.util.Collection<V>
iterator
in interface java.util.List<V>
public java.util.List<V> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<V>
public java.util.ListIterator<V> listIterator()
listIterator
in interface java.util.List<V>
public java.util.ListIterator<V> listIterator(int i)
listIterator
in interface java.util.List<V>
public V set(int i, V o)
set
in interface java.util.List<V>
public <T> T[] toArray(T[] a)
toArray
in interface java.util.Collection<V>
toArray
in interface java.util.List<V>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |