| /******************************************************************************* |
| * Copyright (c) 2017 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.osgi.tests.util; |
| |
| import java.util.*; |
| |
| public class MapDictionary<K, V> extends Dictionary<K, V> { |
| Map<K, V> map = new HashMap<K, V>(); |
| |
| @Override |
| public int size() { |
| return map.size(); |
| } |
| |
| @Override |
| public boolean isEmpty() { |
| return map.isEmpty(); |
| } |
| |
| @Override |
| public Enumeration<K> keys() { |
| return Collections.enumeration(map.keySet()); |
| } |
| |
| @Override |
| public Enumeration<V> elements() { |
| return Collections.enumeration(map.values()); |
| } |
| |
| @Override |
| public V get(Object key) { |
| return map.get(key); |
| } |
| |
| @Override |
| public V put(K key, V value) { |
| return map.put(key, value); |
| } |
| |
| @Override |
| public V remove(Object key) { |
| return map.remove(key); |
| } |
| |
| } |