forked from IvanLu1024/Java-Notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAVLMap.java
More file actions
50 lines (40 loc) · 910 Bytes
/
Copy pathAVLMap.java
File metadata and controls
50 lines (40 loc) · 910 Bytes
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
package code_10_avl.map;
import code_10_avl.AVLTree;
import code_10_avl.map.Map;
/**
* Created by 18351 on 2018/12/31.
*/
public class AVLMap<K extends Comparable<K>,V> implements Map<K,V> {
private AVLTree<K,V> avlTree;
public AVLMap(){
avlTree=new AVLTree<>();
}
@Override
public void add(K key, V value) {
avlTree.add(key,value);
}
@Override
public V remove(K key) {
return avlTree.remove(key);
}
@Override
public boolean contains(K key) {
return avlTree.contains(key);
}
@Override
public V get(K key) {
return avlTree.get(key);
}
@Override
public void set(K key, V newValue) {
avlTree.set(key,newValue);
}
@Override
public int getSize() {
return avlTree.getSize();
}
@Override
public boolean isEmpty() {
return avlTree.isEmpty();
}
}