/** * Constructs an empty {@code EnumMap} using the given key type. * * @param keyType * the class object giving the type of the keys used by this {@code EnumMap}. * @throws NullPointerException * if {@code keyType} is {@code null}. */ public EnumMap(Class<K> keyType) { initialization(keyType); }
/** * Constructs an {@code EnumMap} using the same key type as the given {@code EnumMap} and * initially containing the same mappings. * * @param map * the {@code EnumMap} from which this {@code EnumMap} is initialized. * @throws NullPointerException * if {@code map} is {@code null}. */ public EnumMap(EnumMap<K, ? extends V> map) { initialization(map); }
@SuppressWarnings("unchecked") private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); initialization(keyType); int elementCount = stream.readInt(); Enum<K> enumKey; Object value; for (int i = elementCount; i > 0; i--) { enumKey = (Enum<K>) stream.readObject(); value = stream.readObject(); putImpl((K) enumKey, (V) value); } }
/** * Returns a shallow copy of this {@code EnumMap}. * * @return a shallow copy of this {@code EnumMap}. */ @SuppressWarnings("unchecked") @Override public EnumMap<K, V> clone() { try { EnumMap<K, V> enumMap = (EnumMap<K, V>) super.clone(); enumMap.initialization(this); return enumMap; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } }
public EnumMap(Map<K, ? extends V> map) { if (map instanceof EnumMap) { initialization((EnumMap<K, V>) map); } else { if (map.isEmpty()) { Class clazz = enumKey.getClass(); if (clazz.isEnum()) { initialization(clazz); } else { initialization(clazz.getSuperclass());
/** * Constructs an {@code EnumMap} using the same key type as the given {@code EnumMap} and * initially containing the same mappings. * * @param map * the {@code EnumMap} from which this {@code EnumMap} is initialized. * @throws NullPointerException * if {@code map} is {@code null}. */ public EnumMap(EnumMap<K, ? extends V> map) { initialization(map); }
/** * Constructs an empty {@code EnumMap} using the given key type. * * @param keyType * the class object giving the type of the keys used by this {@code EnumMap}. * @throws NullPointerException * if {@code keyType} is {@code null}. */ public EnumMap(Class<K> keyType) { initialization(keyType); }
/** * Constructs an {@code EnumMap} using the same key type as the given {@code EnumMap} and * initially containing the same mappings. * * @param map * the {@code EnumMap} from which this {@code EnumMap} is initialized. * @throws NullPointerException * if {@code map} is {@code null}. */ public EnumMap(EnumMap<K, ? extends V> map) { initialization(map); }
/** * Constructs an empty {@code EnumMap} using the given key type. * * @param keyType * the class object giving the type of the keys used by this {@code EnumMap}. * @throws NullPointerException * if {@code keyType} is {@code null}. */ public EnumMap(Class<K> keyType) { initialization(keyType); }
/** * Constructs an {@code EnumMap} using the same key type as the given {@code EnumMap} and * initially containing the same mappings. * * @param map * the {@code EnumMap} from which this {@code EnumMap} is initialized. * @throws NullPointerException * if {@code map} is {@code null}. */ public EnumMap(EnumMap<K, ? extends V> map) { initialization(map); }
/** * Constructs an {@code EnumMap} using the same key type as the given {@code EnumMap} and * initially containing the same mappings. * * @param map * the {@code EnumMap} from which this {@code EnumMap} is initialized. * @throws NullPointerException * if {@code map} is {@code null}. */ public EnumMap(EnumMap<K, ? extends V> map) { initialization(map); }
/** * Constructs an {@code EnumMap} using the same key type as the given {@code EnumMap} and * initially containing the same mappings. * * @param map * the {@code EnumMap} from which this {@code EnumMap} is initialized. * @throws NullPointerException * if {@code map} is {@code null}. */ public EnumMap(EnumMap<K, ? extends V> map) { initialization(map); }
/** * Constructs an {@code EnumMap} using the same key type as the given {@code EnumMap} and * initially containing the same mappings. * * @param map * the {@code EnumMap} from which this {@code EnumMap} is initialized. * @throws NullPointerException * if {@code map} is {@code null}. */ public EnumMap(EnumMap<K, ? extends V> map) { initialization(map); }
/** * Constructs an empty {@code EnumMap} using the given key type. * * @param keyType * the class object giving the type of the keys used by this {@code EnumMap}. * @throws NullPointerException * if {@code keyType} is {@code null}. */ public EnumMap(Class<K> keyType) { initialization(keyType); }
/** * Constructs an empty {@code EnumMap} using the given key type. * * @param keyType * the class object giving the type of the keys used by this {@code EnumMap}. * @throws NullPointerException * if {@code keyType} is {@code null}. */ public EnumMap(Class<K> keyType) { initialization(keyType); }
/** * Constructs an empty {@code EnumMap} using the given key type. * * @param keyType * the class object giving the type of the keys used by this {@code EnumMap}. * @throws NullPointerException * if {@code keyType} is {@code null}. */ public EnumMap(Class<K> keyType) { initialization(keyType); }
/** * Constructs an empty {@code EnumMap} using the given key type. * * @param keyType * the class object giving the type of the keys used by this {@code EnumMap}. * @throws NullPointerException * if {@code keyType} is {@code null}. */ public EnumMap(Class<K> keyType) { initialization(keyType); }
/** * Constructs an empty {@code EnumMap} using the given key type. * * @param keyType * the class object giving the type of the keys used by this {@code EnumMap}. * @throws NullPointerException * if {@code keyType} is {@code null}. */ public EnumMap(Class<K> keyType) { initialization(keyType); }
/** * Constructs an {@code EnumMap} using the same key type as the given {@code EnumMap} and * initially containing the same mappings. * * @param map * the {@code EnumMap} from which this {@code EnumMap} is initialized. * @throws NullPointerException * if {@code map} is {@code null}. */ public EnumMap(EnumMap<K, ? extends V> map) { initialization(map); }
@SuppressWarnings("unchecked") private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); initialization(keyType); int elementCount = stream.readInt(); Enum<K> enumKey; Object value; for (int i = elementCount; i > 0; i--) { enumKey = (Enum<K>) stream.readObject(); value = stream.readObject(); putImpl((K) enumKey, (V) value); } }