|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectDictionary<K,D>
List<K,D>
K
- The type of the keysD
- The type of the datapublic class List<K,D>
A List is a Map
implemented as double-linked list.
There are linear time insertion and lookup operations.
Moreover, there are constant time operations to add an element
in front of the list or at the end of the list. However, if these
constant time operations are used,
then the list is not a Map
any more, e.g., there
might be multiple data-entries for the same key.
Note, that null
-values
are not supported as keys.
Constructor Summary | |
---|---|
List()
|
Method Summary | |
---|---|
void |
append(K k,
D d)
Appends the value k -> d at the end of the list. |
void |
delete(K k)
Deletes the (first) element of this list with given key k, if such an element exists. |
D |
find(K k)
Looks up the data stored under the key k. |
void |
insert(K k,
D d)
Associates the data d to the key k in this map. |
boolean |
iselement(K k)
Checks whether the key k is present in this map. |
Listiterator<K,D> |
iterator()
Creates a new iterator over all associations between keys and data. |
void |
prepend(K k,
D d)
Appends the value k -> d at the beginning of the list. |
Methods inherited from class Dictionary |
---|
array, isempty, print, simpleiterator, size |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public List()
Method Detail |
---|
public void insert(K k, D d)
Map
insert
in interface Map<K,D>
insert
in class Dictionary<K,D>
k
- The key to store.d
- The data associated to the key k.public boolean iselement(K k)
iselement
in interface Map<K,D>
iselement
in class Dictionary<K,D>
k
- The key to look for.
Map.iselement(Object)
public void append(K k, D d)
Map
.
k
- d
- public void prepend(K k, D d)
Map
.
k
- d
- public D find(K k)
find
in interface Map<K,D>
find
in class Dictionary<K,D>
k
- The key under which the data is stored.
Map.find(Object)
public void delete(K k)
delete
in interface Map<K,D>
delete
in class Dictionary<K,D>
k
- The key which should be deleted.public Listiterator<K,D> iterator()
Map
iterator
in interface Map<K,D>
iterator
in class Dictionary<K,D>
Iterator
over all keys with
associated data.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |