summaryrefslogtreecommitdiff
path: root/sources/ch/epfl/lamp/util/ForwardingMap.java
blob: 7efc3627b0d3e32f5a787b38e96961b936a955b7 (plain) (blame)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package ch.epfl.lamp.util;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

/**
 * This class implements the interface Map by forwarding all its
 * operations to an underlying instance of Map.
 */
public class ForwardingMap implements Map {

    //########################################################################
    // Protected Fields

    protected final Map delegate;

    //########################################################################
    // Public Constructors

    public ForwardingMap(Map delegate) {
        this.delegate = delegate;
    }

    //########################################################################
    // Public Methods - Query operations

    public int size() {
        return delegate.size();
    }

    public boolean isEmpty() {
        return delegate.isEmpty();
    }

    public boolean containsKey(Object key) {
        return delegate.containsKey(key);
    }

    public boolean containsValue(Object value) {
        return delegate.containsValue(value);
    }

    public Object get(Object key) {
        return delegate.get(key);
    }

    //########################################################################
    // Public Methods - Modification operations

    public Object put(Object key, Object value) {
        return delegate.put(key, value);
    }

    public Object remove(Object key) {
        return delegate.remove(key);
    }

    //########################################################################
    // Public Methods - Bulk operations

    public void putAll(Map map) {
        delegate.putAll(map);
    }

    public void clear() {
        delegate.clear();
    }

    //########################################################################
    // Public Methods - Views

    public Set keySet() {
        return delegate.keySet();
    }

    public Collection values() {
        return delegate.values();
    }

    public Set entrySet() {
        return delegate.entrySet();
    }

    //########################################################################
    // Public Methods - Comparison and hashing

    public boolean equals(Object that) {
        return delegate.equals(that);
    }

    public int hashCode() {
        return delegate.hashCode();
    }

    //########################################################################
}