1 36 package org.ungoverned.oscar.util; 37 38 import java.util.*; 39 40 41 45 public class MapToDictionary extends Dictionary 46 { 47 50 private Map m_map = null; 51 52 public MapToDictionary(Map map) 53 { 54 m_map = map; 55 } 56 57 public Enumeration elements() 58 { 59 if (m_map == null) 60 { 61 return null; 62 } 63 return new IteratorToEnumeration(m_map.values().iterator()); 64 } 65 66 public Object get(Object key) 67 { 68 if (m_map == null) 69 { 70 return null; 71 } 72 return m_map.get(key); 73 } 74 75 public boolean isEmpty() 76 { 77 if (m_map == null) 78 { 79 return true; 80 } 81 return m_map.isEmpty(); 82 } 83 84 public Enumeration keys() 85 { 86 if (m_map == null) 87 { 88 return null; 89 } 90 return new IteratorToEnumeration(m_map.keySet().iterator()); 91 } 92 93 public Object put(Object key, Object value) 94 { 95 throw new UnsupportedOperationException (); 96 } 97 98 public Object remove(Object key) 99 { 100 throw new UnsupportedOperationException (); 101 } 102 103 public int size() 104 { 105 if (m_map == null) 106 { 107 return 0; 108 } 109 return m_map.size(); 110 } 111 } | Popular Tags |