forked from sukeswan/Poem-Generator-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDictionaryInterface.java
More file actions
21 lines (15 loc) · 888 Bytes
/
DictionaryInterface.java
File metadata and controls
21 lines (15 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Dictionary that stores values of type Object indexed by keys of type String
interface DictionaryInterface {
public boolean isEmpty(); // returns true if the Dictionary is empty, false otherwise.
public int size(); // Returns the number of key/value pairs stored in the dictionary.
// Adds a value stored under the given key. If the key has already been stored
// in the Dictionary,
// replaces the value associated with the key and returns the old value. If the
// key isn't in the dictionary
// returns null.
public Object put(String key, Object value);
public Object get(String key); // Retrieves the value stored with the key.
public void remove(String key); // Deletes the key/value pair stored with the given key.
public void clear(); // Empties the dictionary.
public String[] getKeys(); // Returns an array of all the keys currently stored in the Dictionary.
}