Skip to content

Commit 2dcf295

Browse files
committed
update DoubleKeyValueMap
1 parent 62098e4 commit 2dcf295

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

library/src/com/lidroid/xutils/util/core/DoubleKeyValueMap.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ public Set<K1> getFirstKeys() {
4747
return k1_k2V_map.keySet();
4848
}
4949

50+
public ConcurrentHashMap<K2, V> get(K1 key1) {
51+
return k1_k2V_map.get(key1);
52+
}
53+
5054
public V get(K1 key1, K2 key2) {
5155
ConcurrentHashMap<K2, V> k2_v = k1_k2V_map.get(key1);
5256
return k2_v == null ? null : k2_v.get(key2);
5357
}
5458

55-
public ConcurrentHashMap<K2, V> get(K1 key1) {
56-
return k1_k2V_map.get(key1);
57-
}
58-
5959
public boolean containsKey(K1 key1, K2 key2) {
6060
if (k1_k2V_map.containsKey(key1)) {
6161
return k1_k2V_map.get(key1).containsKey(key2);
@@ -67,6 +67,16 @@ public boolean containsKey(K1 key1) {
6767
return k1_k2V_map.containsKey(key1);
6868
}
6969

70+
public int size() {
71+
if (k1_k2V_map.size() == 0) return 0;
72+
73+
int result = 0;
74+
for (ConcurrentHashMap<K2, V> k2V_map : k1_k2V_map.values()) {
75+
result += k2V_map.size();
76+
}
77+
return result;
78+
}
79+
7080
public void clear() {
7181
if (k1_k2V_map.size() > 0) {
7282
for (ConcurrentHashMap<K2, V> k2V_map : k1_k2V_map.values()) {

0 commit comments

Comments
 (0)