1 8 package org.apache.axis.utils; 9 10 import java.util.HashMap ; 11 import java.util.Map ; 12 13 17 public class IdentityHashMap extends HashMap 18 { 19 24 public IdentityHashMap(int initialCapacity, float loadFactor) 25 { 26 super(initialCapacity, loadFactor); 27 } 28 29 33 public IdentityHashMap(int initialCapacity) 34 { 35 super(initialCapacity); 36 } 37 38 41 public IdentityHashMap() 42 { 43 super(); 44 } 45 46 50 public IdentityHashMap(Map t) 51 { 52 super(t); 53 } 54 55 58 public Object get(Object key) 59 { 60 return super.get(new IDKey(key)); 61 } 62 63 66 public Object put(Object key, Object value) 67 { 68 return super.put(new IDKey(key), value); 69 } 70 71 74 public Object add(Object value) 75 { 76 Object key = new IDKey(value); 77 if (! super.containsKey(key)) 78 { 79 return super.put(key, value); 80 } 81 else return null; 82 83 } 84 85 88 public Object remove(Object key) 89 { 90 return super.remove(new IDKey(key)); 91 } 92 93 96 public boolean containsKey(Object key) 97 { 98 return super.containsKey(new IDKey(key)); 99 } 100 } 101 | Popular Tags |