1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.collections4.splitmap;
18
19 import java.util.Collection;
20 import java.util.Map;
21 import java.util.Objects;
22 import java.util.Set;
23
24 import org.apache.commons.collections4.IterableGet;
25 import org.apache.commons.collections4.MapIterator;
26 import org.apache.commons.collections4.map.EntrySetToMapIteratorAdapter;
27
28
29
30
31
32
33
34
35
36 public class AbstractIterableGetMapDecorator<K, V> implements IterableGet<K, V> {
37
38
39 transient Map<K, V> map;
40
41
42
43
44 protected AbstractIterableGetMapDecorator() {
45 }
46
47
48
49
50
51
52 public AbstractIterableGetMapDecorator(final Map<K, V> map) {
53 this.map = Objects.requireNonNull(map, "map");
54 }
55
56 @Override
57 public boolean containsKey(final Object key) {
58 return decorated().containsKey(key);
59 }
60
61 @Override
62 public boolean containsValue(final Object value) {
63 return decorated().containsValue(value);
64 }
65
66
67
68
69
70
71 protected Map<K, V> decorated() {
72 return map;
73 }
74
75 @Override
76 public Set<Map.Entry<K, V>> entrySet() {
77 return decorated().entrySet();
78 }
79
80 @Override
81 public boolean equals(final Object object) {
82 if (object == this) {
83 return true;
84 }
85 return decorated().equals(object);
86 }
87
88 @Override
89 public V get(final Object key) {
90 return decorated().get(key);
91 }
92
93 @Override
94 public int hashCode() {
95 return decorated().hashCode();
96 }
97
98 @Override
99 public boolean isEmpty() {
100 return decorated().isEmpty();
101 }
102
103 @Override
104 public Set<K> keySet() {
105 return decorated().keySet();
106 }
107
108
109
110
111
112 @Override
113 public MapIterator<K, V> mapIterator() {
114 return new EntrySetToMapIteratorAdapter<>(entrySet());
115 }
116
117 @Override
118 public V remove(final Object key) {
119 return decorated().remove(key);
120 }
121
122 @Override
123 public int size() {
124 return decorated().size();
125 }
126
127 @Override
128 public String toString() {
129 return decorated().toString();
130 }
131
132 @Override
133 public Collection<V> values() {
134 return decorated().values();
135 }
136
137 }