forked from liuyubobobo/Play-with-Data-Structures
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AVLMap.java
43 lines (34 loc) · 749 Bytes
/
AVLMap.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
public class AVLMap<K extends Comparable<K>, V> implements Map<K, V> {
private AVLTree<K, V> avl;
public AVLMap(){
avl = new AVLTree<>();
}
@Override
public int getSize(){
return avl.getSize();
}
@Override
public boolean isEmpty(){
return avl.isEmpty();
}
@Override
public void add(K key, V value){
avl.add(key, value);
}
@Override
public boolean contains(K key){
return avl.contains(key);
}
@Override
public V get(K key){
return avl.get(key);
}
@Override
public void set(K key, V newValue){
avl.set(key, newValue);
}
@Override
public V remove(K key){
return avl.remove(key);
}
}