-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMap.java
68 lines (61 loc) · 1.27 KB
/
Map.java
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* Interface of Map.
*
* @param <K> type of keys
* @param <V> type of values
*/
interface Map<K, V> {
/**
* Return size of the map.
*
* @return size
*/
int size();
/**
* Check whether the map is empty.
*
* @return empty or not
*/
boolean isEmpty();
/**
* Get value with specified key.
*
* @param k key to be found
* @return element with given key or null if it doesn't exist
*/
V get(K k);
/**
* Put element with specified key and value and return old value.
*
* @param k key
* @param v value
* @return old value with specified key or null if it didn't exist
*/
V put(K k, V v);
/**
* Remove the element with specified key and return its value or null
* if it didn't exist.
*
* @param k key
* @return the removed value or null
*/
V remove(K k);
/**
* Returns the set of keys.
*
* @return set of keys (unique)
*/
Set<K> keySet();
/**
* Returns the collection of values.
*
* @return collection of values
*/
Collection<V> values();
/**
* Returns the set of entries (keys and values).
*
* @return set of entries
*/
Set<Entry<K, V>> entrySet();
}