Package: MapToDictionaryAdapter

MapToDictionaryAdapter

nameinstructionbranchcomplexitylinemethod
MapToDictionaryAdapter(Map)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
elements()
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
get(Object)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
isEmpty()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
keys()
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
put(Object, Object)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
remove(Object)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
size()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2012 VMware Inc.
3: * All rights reserved. This program and the accompanying materials
4: * are made available under the terms of the Eclipse Public License v1.0
5: * which accompanies this distribution, and is available at
6: * http://www.eclipse.org/legal/epl-v10.html
7: *
8: * Contributors:
9: * VMware Inc. - initial contribution
10: *******************************************************************************/
11:
12: package org.eclipse.virgo.util.common;
13:
14: import java.util.Dictionary;
15: import java.util.Enumeration;
16: import java.util.Map;
17:
18: /**
19: * {@link MapToDictionaryAdapter} adapts a {@link Map} instance to conform to the {@link Dictionary} interface.
20: * <p />
21: *
22: * <strong>Concurrent Semantics</strong><br />
23: * Thread safe.
24: */
25: public class MapToDictionaryAdapter<K, V> extends Dictionary<K, V> {
26:
27: private final Map<K, V> map;
28:
29: public MapToDictionaryAdapter(Map<K, V> map) {
30: this.map = map;
31: }
32:
33: @Override
34: public int size() {
35: return map.size();
36: }
37:
38: @Override
39: public boolean isEmpty() {
40: return map.isEmpty();
41: }
42:
43: @Override
44: public Enumeration<K> keys() {
45: return new IteratorToEnumerationAdapter<K>(map.keySet().iterator());
46: }
47:
48: @Override
49: public Enumeration<V> elements() {
50: return new IteratorToEnumerationAdapter<V>(map.values().iterator());
51: }
52:
53: @Override
54: public V get(Object key) {
55: return this.map.get(key);
56: }
57:
58: @Override
59: public V put(K key, V value) {
60: return this.map.put(key, value);
61: }
62:
63: @Override
64: public V remove(Object key) {
65: return this.map.remove(key);
66: }
67:
68: }