1 16 package org.apache.commons.collections.map; 17 18 import java.util.Collection ; 19 import java.util.Map ; 20 import java.util.Set ; 21 22 41 public abstract class AbstractMapDecorator implements Map { 42 43 44 protected transient Map map; 45 46 50 protected AbstractMapDecorator() { 51 super(); 52 } 53 54 60 public AbstractMapDecorator(Map map) { 61 if (map == null) { 62 throw new IllegalArgumentException ("Map must not be null"); 63 } 64 this.map = map; 65 } 66 67 72 protected Map getMap() { 73 return map; 74 } 75 76 public void clear() { 78 map.clear(); 79 } 80 81 public boolean containsKey(Object key) { 82 return map.containsKey(key); 83 } 84 85 public boolean containsValue(Object value) { 86 return map.containsValue(value); 87 } 88 89 public Set entrySet() { 90 return map.entrySet(); 91 } 92 93 public Object get(Object key) { 94 return map.get(key); 95 } 96 97 public boolean isEmpty() { 98 return map.isEmpty(); 99 } 100 101 public Set keySet() { 102 return map.keySet(); 103 } 104 105 public Object put(Object key, Object value) { 106 return map.put(key, value); 107 } 108 109 public void putAll(Map mapToCopy) { 110 map.putAll(mapToCopy); 111 } 112 113 public Object remove(Object key) { 114 return map.remove(key); 115 } 116 117 public int size() { 118 return map.size(); 119 } 120 121 public Collection values() { 122 return map.values(); 123 } 124 125 public boolean equals(Object object) { 126 if (object == this) { 127 return true; 128 } 129 return map.equals(object); 130 } 131 132 public int hashCode() { 133 return map.hashCode(); 134 } 135 136 public String toString() { 137 return map.toString(); 138 } 139 140 } 141 | Popular Tags |