/** * Creates a new instance of this object. * * @param normalMap the normal direction map * @param reverseMap the reverse direction map * @param inverseBidiMap the inverse BidiMap * @return new bidi map */ @Override protected BidiMap<V, K> createBidiMap(final Map<V, K> normalMap, final Map<K, V> reverseMap, final BidiMap<K, V> inverseBidiMap) { return new DualLinkedHashBidiMap<>(normalMap, reverseMap, inverseBidiMap); }
/** * Constructs a <code>LinkedHashBidiMap</code> and copies the mappings from * specified <code>Map</code>. * * @param map the map whose mappings are to be placed in this map */ public DualLinkedHashBidiMap(final Map<? extends K, ? extends V> map) { super(new LinkedHashMap<K, V>(), new LinkedHashMap<V, K>()); putAll(map); }
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); normalMap = new LinkedHashMap<>(); reverseMap = new LinkedHashMap<>(); @SuppressWarnings("unchecked") // will fail at runtime if stream is incorrect final Map<K, V> map = (Map<K, V>) in.readObject(); putAll(map); } }