1 16 package org.apache.commons.collections.bidimap; 17 18 import java.io.IOException ; 19 import java.io.ObjectInputStream ; 20 import java.io.ObjectOutputStream ; 21 import java.io.Serializable ; 22 import java.util.HashMap ; 23 import java.util.Map ; 24 25 import org.apache.commons.collections.BidiMap; 26 27 44 public class DualHashBidiMap 45 extends AbstractDualBidiMap implements Serializable { 46 47 48 private static final long serialVersionUID = 721969328361808L; 49 50 53 public DualHashBidiMap() { 54 super(new HashMap (), new HashMap ()); 55 } 56 57 63 public DualHashBidiMap(Map map) { 64 super(new HashMap (), new HashMap ()); 65 putAll(map); 66 } 67 68 75 protected DualHashBidiMap(Map normalMap, Map reverseMap, BidiMap inverseBidiMap) { 76 super(normalMap, reverseMap, inverseBidiMap); 77 } 78 79 87 protected BidiMap createBidiMap(Map normalMap, Map reverseMap, BidiMap inverseBidiMap) { 88 return new DualHashBidiMap(normalMap, reverseMap, inverseBidiMap); 89 } 90 91 private void writeObject(ObjectOutputStream out) throws IOException { 94 out.defaultWriteObject(); 95 out.writeObject(maps[0]); 96 } 97 98 private void readObject(ObjectInputStream in) throws IOException , ClassNotFoundException { 99 in.defaultReadObject(); 100 maps[0] = new HashMap (); 101 maps[1] = new HashMap (); 102 Map map = (Map ) in.readObject(); 103 putAll(map); 104 } 105 106 } 107 | Popular Tags |