Removes an object from the TripleKeyMap. @param key1 The primary key used to remove the value in this TripleKeyMap. @param key2 The secondary key used to remove the value in this TripleKeyMap. @param key3 The tertiary key used to remove the value in this
(K1 key1, K2 key2, K3 key3)
| 203 | * given keys. |
| 204 | */ |
| 205 | public V remove(K1 key1, K2 key2, K3 key3) |
| 206 | { |
| 207 | Map<K3, V> localMap = map.get(key1, key2); |
| 208 | if (localMap == null) |
| 209 | { |
| 210 | return null; |
| 211 | } |
| 212 | V removed = localMap.remove(key3); |
| 213 | /* |
| 214 | * Clean up the primary maps if the secondary maps are empty. This is |
| 215 | * required to avoid a false report from get*KeySet. Generally, if an |
| 216 | * object is added with the keys KEY1 and KEY2, then subsequently |
| 217 | * removed (and no other objects were stored with those keys), then |
| 218 | * getKeySet() should never return KEY1 (and there is a corollary for |
| 219 | * KEY2 cleanup, though that is implicit and does not require special |
| 220 | * code) |
| 221 | */ |
| 222 | if (localMap.isEmpty()) |
| 223 | { |
| 224 | map.remove(key1, key2); |
| 225 | } |
| 226 | return removed; |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Returns a Set which contains the primary keys for this TripleKeyMap. |