@Override @Nonnull public <K2 extends K> UpdatableLHashSeparateKVObjShortMapGO<K2> newUpdatableMap( Map<? extends K2, Short> map, int expectedSize) { if (map instanceof ObjShortMap) { // noinspection unchecked ObjShortMap<K2> objShortMap = (ObjShortMap<K2>) map; if (map instanceof SeparateKVObjShortLHash) { SeparateKVObjShortLHash hash = (SeparateKVObjShortLHash) map; if (hash.hashConfig().equals(hashConf) && objShortMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableLHashSeparateKVObjShortMapGO<K2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableLHashSeparateKVObjShortMapGO<K2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableLHashSeparateKVObjShortMapGO<K2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, Short> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }
@Override @Nonnull public <K2 extends K> UpdatableLHashSeparateKVObjShortMapGO<K2> newUpdatableMap( Map<? extends K2, Short> map, int expectedSize) { if (map instanceof ObjShortMap) { // noinspection unchecked ObjShortMap<K2> objShortMap = (ObjShortMap<K2>) map; if (map instanceof SeparateKVObjShortLHash) { SeparateKVObjShortLHash hash = (SeparateKVObjShortLHash) map; if (hash.hashConfig().equals(hashConf) && objShortMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableLHashSeparateKVObjShortMapGO<K2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableLHashSeparateKVObjShortMapGO<K2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableLHashSeparateKVObjShortMapGO<K2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, Short> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }