|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
K
- The type of the keys.D
- The type of the data.public interface Map<K,D>
A Map is a data structure to store data under key
values, or just keys. For each key there can be at
most one datum that is associated to that key.
Maps provide methods to lookup data find(Object)
,
to change the map insert(Object, Object)
, delete(Object)
,
to iteratate over keys simpleiterator()
and
over both keys and data iterator()
. Moreover,
there are possibilities to display a map print()
and to store a map in an array array()
.
Method Summary | |
---|---|
Array<K> |
array()
Converts this map into an array of all keys. |
void |
delete(K k)
Removes the entry which stores the data for the key k. |
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. |
boolean |
isempty()
Checks, whether this map is empty, i.e., checks size() == 0. |
Iterator<K,D> |
iterator()
Creates a new iterator over all associations between keys and data. |
void |
print()
Prints the map to stdout |
SimpleIterator<K> |
simpleiterator()
Creates a new iterator only over the keys. |
int |
size()
Returns the size of this map, i.e. the number of keys, under which data is stored. |
Method Detail |
---|
void insert(K k, D d)
k
- The key to store.d
- The data associated to the key k.void delete(K k)
k
- The key to delete with its associated data.D find(K k)
k
- The key under which the data is stored.
boolean iselement(K k)
k
- The key to look for.
int size()
boolean isempty()
Iterator<K,D> iterator()
Iterator
over all keys with
associated data.SimpleIterator<K> simpleiterator()
SimpleIterator
over all keys.Array<K> array()
void print()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |