-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDictionary.pde
30 lines (24 loc) · 943 Bytes
/
Dictionary.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
interface Dictionary<K extends Comparable<K>,V> {
/** Inserts key into the dictionary with the specified value associated.
* If key is already present (determined using compareTo() == 0), it overwrites the old value with the new value.
*/
public void put(K key, V value);
/** Returns true if key is in the dictionary.
*/
public boolean contains(K key);
/** Returns whatever V object is stored in the dictionary under key.
* Returns null if key is not stored in the dictionary.
*/
public V get(K key);
/** Returns whatever V object is stored in the dictionary under key and deletes that object from the dictionary.
* If key is not in the dictionary, this method throws an AssertionError or NullPointerException.
*/
public V remove(K key);
/** Removes all key-value pairs
*
*/
public void clear();
/** Returns the number of key-value pairs
*/
public int size();
}