ObjShortMap m2 = (ObjShortMap) another; if ( m2.keyEquivalence().equals(map.keyEquivalence()) if (map.size() < m2.size()) return false; if (m2 instanceof InternalObjShortMapOps) { return m2.forEachWhile(new ObjShortPredicate() { @Override
public static <K> void putAll(final InternalObjShortMapOps<K> map, Map<? extends K, ? extends Short> another) { if (map == another) throw new IllegalArgumentException(); long maxPossibleSize = map.sizeAsLong() + Containers.sizeAsLong(another); map.ensureCapacity(maxPossibleSize); if (another instanceof ObjShortMap) { if (another instanceof InternalObjShortMapOps) { ((InternalObjShortMapOps) another).reversePutAllTo(map); } else { ((ObjShortMap) another).forEach(new ObjShortConsumer<K>() { @Override public void accept(K key, short value) { map.justPut(key, value); } }); } } else { for (Map.Entry<? extends K, ? extends Short> e : another.entrySet()) { map.justPut(e.getKey(), e.getValue()); } } }
@Override @Nonnull public <K2 extends K> UpdatableLHashSeparateKVObjShortMapGO<K2> newUpdatableMap( Map<? extends K2, Short> map, int expectedSize) { if (map instanceof ObjShortMap) { @SuppressWarnings("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> UpdatableQHashSeparateKVObjShortMapGO<K2> newUpdatableMap( Map<? extends K2, Short> map, int expectedSize) { if (map instanceof ObjShortMap) { @SuppressWarnings("unchecked") ObjShortMap<K2> objShortMap = (ObjShortMap<K2>) map; if (map instanceof SeparateKVObjShortQHash) { SeparateKVObjShortQHash hash = (SeparateKVObjShortQHash) map; if (hash.hashConfig().equals(hashConf) && objShortMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableQHashSeparateKVObjShortMapGO<K2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableQHashSeparateKVObjShortMapGO<K2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableQHashSeparateKVObjShortMapGO<K2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, Short> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }
ObjShortMap m2 = (ObjShortMap) another; if ( m2.keyEquivalence().equals(map.keyEquivalence()) if (map.size() < m2.size()) return false; if (m2 instanceof InternalObjShortMapOps) { return m2.forEachWhile(new ObjShortPredicate() { @Override
@Override @Nonnull public <K2 extends K> UpdatableLHashSeparateKVObjShortMapGO<K2> newUpdatableMap( Map<? extends K2, Short> map, int expectedSize) { if (map instanceof ObjShortMap) { @SuppressWarnings("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; } } }
public static <K> void putAll(final InternalObjShortMapOps<K> map, Map<? extends K, ? extends Short> another) { if (map == another) throw new IllegalArgumentException(); long maxPossibleSize = map.sizeAsLong() + Containers.sizeAsLong(another); map.ensureCapacity(maxPossibleSize); if (another instanceof ObjShortMap) { if (another instanceof InternalObjShortMapOps) { ((InternalObjShortMapOps) another).reversePutAllTo(map); } else { ((ObjShortMap) another).forEach(new ObjShortConsumer<K>() { @Override public void accept(K key, short value) { map.justPut(key, value); } }); } } else { for (Map.Entry<? extends K, ? extends Short> e : another.entrySet()) { map.justPut(e.getKey(), e.getValue()); } } }
@Override @Nonnull public <K2 extends K> UpdatableQHashSeparateKVObjShortMapGO<K2> newUpdatableMap( Map<? extends K2, Short> map, int expectedSize) { if (map instanceof ObjShortMap) { @SuppressWarnings("unchecked") ObjShortMap<K2> objShortMap = (ObjShortMap<K2>) map; if (map instanceof SeparateKVObjShortQHash) { SeparateKVObjShortQHash hash = (SeparateKVObjShortQHash) map; if (hash.hashConfig().equals(hashConf) && objShortMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableQHashSeparateKVObjShortMapGO<K2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableQHashSeparateKVObjShortMapGO<K2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableQHashSeparateKVObjShortMapGO<K2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, Short> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }