| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | package com.sun.fortress.useful; |
|---|
| 19 | |
|---|
| 20 | import java.util.Collection; |
|---|
| 21 | import java.util.Collections; |
|---|
| 22 | import java.util.Map; |
|---|
| 23 | import java.util.Set; |
|---|
| 24 | |
|---|
| 25 | public interface IMultiMap<K, V> extends Map<K, Set<V>> { |
|---|
| 26 | |
|---|
| 27 | public void addInverse(Map<V, K> m); |
|---|
| 28 | |
|---|
| 29 | public Set<V> putItem(K k, V v); |
|---|
| 30 | |
|---|
| 31 | public Set<V> putItems(K k, Set<V> vs); |
|---|
| 32 | |
|---|
| 33 | public Set<V> removeItem(K k, V v); |
|---|
| 34 | |
|---|
| 35 | public final static IMultiMap EMPTY_MULTIMAP = new IMultiMap() { |
|---|
| 36 | private <T> T error() { throw new IllegalStateException("Empty IMultiMap is immutable."); } |
|---|
| 37 | public void addInverse(Map m) { error(); } |
|---|
| 38 | public Set putItem(Object k, Object v) { return error(); } |
|---|
| 39 | public Set putItems(Object k, Set vs) { return error(); } |
|---|
| 40 | public Set removeItem(Object k, Object v) { return error(); } |
|---|
| 41 | public void clear() { error(); } |
|---|
| 42 | public boolean containsKey(Object arg0) { return false; } |
|---|
| 43 | public boolean containsValue(Object arg0) { return false; } |
|---|
| 44 | public Set entrySet() { return Collections.emptySet(); } |
|---|
| 45 | public Object get(Object arg0) { return null; } |
|---|
| 46 | public boolean isEmpty() { return false; } |
|---|
| 47 | public Set keySet() { return Collections.emptySet(); } |
|---|
| 48 | public Object put(Object arg0, Object arg1) { return error(); } |
|---|
| 49 | public void putAll(Map arg0) { error(); } |
|---|
| 50 | public Object remove(Object arg0) { return error(); } |
|---|
| 51 | public int size() { return 0; } |
|---|
| 52 | public Collection values() { return Collections.emptyMap().values(); } |
|---|
| 53 | }; |
|---|
| 54 | } |
|---|