128 }
129
130 public V put(String key, V value) {
131 return map.put(prefix + key, value);
132 }
133
134 public void putAll(Map<? extends String, ? extends V> t) {
135 for (Iterator<? extends Entry<? extends String, ? extends V>> i = t.entrySet().iterator(); i.hasNext(); ) {
136 Map.Entry<? extends String, ? extends V> e = i.next();
137 String key = e.getKey();
138 put(key, e.getValue());
139 }
140 }
141
142 public V remove(Object key) {
143 return map.remove(prefix + key);
144 }
145
146 public int size() {
147 int n = 0;
148 for (Iterator i = map.keySet().iterator(); i.hasNext(); ) {
149 String key = (String) (i.next());
150 if (key.startsWith(prefix))
151 n++;
152 }
153 return n;
154 }
155
156 public Collection<V> values() {
157 Collection<V> c = new Vector<>();
158 for (Iterator<Map.Entry<String, V>> i = map.entrySet().iterator(); i.hasNext(); ) {
159 Map.Entry<String, V> e = i.next();
160 String key = e.getKey();
161 if (key.startsWith(prefix))
162 c.add(e.getValue());
163 }
164 return c;
165 }
166
167 private Map<String, V> map;
168 private String prefix;
169 }
|
128 }
129
130 public V put(String key, V value) {
131 return map.put(prefix + key, value);
132 }
133
134 public void putAll(Map<? extends String, ? extends V> t) {
135 for (Iterator<? extends Entry<? extends String, ? extends V>> i = t.entrySet().iterator(); i.hasNext(); ) {
136 Map.Entry<? extends String, ? extends V> e = i.next();
137 String key = e.getKey();
138 put(key, e.getValue());
139 }
140 }
141
142 public V remove(Object key) {
143 return map.remove(prefix + key);
144 }
145
146 public int size() {
147 int n = 0;
148 for (Iterator<String> i = map.keySet().iterator(); i.hasNext(); ) {
149 String key = (i.next());
150 if (key.startsWith(prefix))
151 n++;
152 }
153 return n;
154 }
155
156 public Collection<V> values() {
157 Collection<V> c = new Vector<>();
158 for (Iterator<Map.Entry<String, V>> i = map.entrySet().iterator(); i.hasNext(); ) {
159 Map.Entry<String, V> e = i.next();
160 String key = e.getKey();
161 if (key.startsWith(prefix))
162 c.add(e.getValue());
163 }
164 return c;
165 }
166
167 private Map<String, V> map;
168 private String prefix;
169 }
|