Read-only empty map. #remove(Object), #clear() and #putAll(Map) with an empty Map as parameter are supported operations (and do nothing) since FreeMarker 2.3.20. @deprecated Use Collections#EMPTY_MAP on J2SE 1.3 or later.
| 13 | * @deprecated Use {@link Collections#EMPTY_MAP} on J2SE 1.3 or later. |
| 14 | */ |
| 15 | public class EmptyMap implements Map, Cloneable { |
| 16 | public static final EmptyMap instance = new EmptyMap(); |
| 17 | |
| 18 | public void clear() { |
| 19 | // no op |
| 20 | } |
| 21 | |
| 22 | public boolean containsKey(Object arg0) { |
| 23 | return false; |
| 24 | } |
| 25 | |
| 26 | public boolean containsValue(Object arg0) { |
| 27 | return false; |
| 28 | } |
| 29 | |
| 30 | public Set entrySet() { |
| 31 | return Collections.EMPTY_SET; |
| 32 | } |
| 33 | |
| 34 | public Object get(Object arg0) { |
| 35 | return null; |
| 36 | } |
| 37 | |
| 38 | public boolean isEmpty() { |
| 39 | return true; |
| 40 | } |
| 41 | |
| 42 | public Set keySet() { |
| 43 | return Collections.EMPTY_SET; |
| 44 | } |
| 45 | |
| 46 | public Object put(Object arg0, Object arg1) { |
| 47 | throw new UnsupportedOperationException("This Map is read-only."); |
| 48 | } |
| 49 | |
| 50 | public void putAll(Map arg0) { |
| 51 | // Checking for arg0.isEmpty() wouldn't reflect precisely how putAll in |
| 52 | // AbstractMap works. |
| 53 | if (arg0.entrySet().iterator().hasNext()) { |
| 54 | throw new UnsupportedOperationException("This Map is read-only."); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | public Object remove(Object arg0) { |
| 59 | return null; |
| 60 | } |
| 61 | |
| 62 | public int size() { |
| 63 | return 0; |
| 64 | } |
| 65 | |
| 66 | public Collection values() { |
| 67 | return Collections.EMPTY_LIST; |
| 68 | } |
| 69 | |
| 70 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…