ObjIntMap m2 = (ObjIntMap) another; if ( m2.keyEquivalence().equals(map.keyEquivalence()) if (map.size() < m2.size()) return false; if (m2 instanceof InternalObjIntMapOps) { return m2.forEachWhile(new ObjIntPredicate() { @Override
public static <K> void putAll(final InternalObjIntMapOps<K> map, Map<? extends K, ? extends Integer> another) { if (map == another) throw new IllegalArgumentException(); long maxPossibleSize = map.sizeAsLong() + Containers.sizeAsLong(another); map.ensureCapacity(maxPossibleSize); if (another instanceof ObjIntMap) { if (another instanceof InternalObjIntMapOps) { ((InternalObjIntMapOps) another).reversePutAllTo(map); } else { ((ObjIntMap) another).forEach(new ObjIntConsumer<K>() { @Override public void accept(K key, int value) { map.justPut(key, value); } }); } } else { for (Map.Entry<? extends K, ? extends Integer> e : another.entrySet()) { map.justPut(e.getKey(), e.getValue()); } } }
@Override @Nonnull public <K2 extends K> UpdatableQHashSeparateKVObjIntMapGO<K2> newUpdatableMap( Map<? extends K2, Integer> map, int expectedSize) { if (map instanceof ObjIntMap) { @SuppressWarnings("unchecked") ObjIntMap<K2> objIntMap = (ObjIntMap<K2>) map; if (map instanceof SeparateKVObjIntQHash) { SeparateKVObjIntQHash hash = (SeparateKVObjIntQHash) map; if (hash.hashConfig().equals(hashConf) && objIntMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableQHashSeparateKVObjIntMapGO<K2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableQHashSeparateKVObjIntMapGO<K2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableQHashSeparateKVObjIntMapGO<K2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, Integer> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }
@Override @Nonnull public <K2 extends K> UpdatableLHashSeparateKVObjIntMapGO<K2> newUpdatableMap( Map<? extends K2, Integer> map, int expectedSize) { if (map instanceof ObjIntMap) { @SuppressWarnings("unchecked") ObjIntMap<K2> objIntMap = (ObjIntMap<K2>) map; if (map instanceof SeparateKVObjIntLHash) { SeparateKVObjIntLHash hash = (SeparateKVObjIntLHash) map; if (hash.hashConfig().equals(hashConf) && objIntMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableLHashSeparateKVObjIntMapGO<K2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableLHashSeparateKVObjIntMapGO<K2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableLHashSeparateKVObjIntMapGO<K2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, Integer> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }
ObjIntMap m2 = (ObjIntMap) another; if ( m2.keyEquivalence().equals(map.keyEquivalence()) if (map.size() < m2.size()) return false; if (m2 instanceof InternalObjIntMapOps) { return m2.forEachWhile(new ObjIntPredicate() { @Override
@Override @Nonnull public <K2 extends K> UpdatableQHashSeparateKVObjIntMapGO<K2> newUpdatableMap( Map<? extends K2, Integer> map, int expectedSize) { if (map instanceof ObjIntMap) { @SuppressWarnings("unchecked") ObjIntMap<K2> objIntMap = (ObjIntMap<K2>) map; if (map instanceof SeparateKVObjIntQHash) { SeparateKVObjIntQHash hash = (SeparateKVObjIntQHash) map; if (hash.hashConfig().equals(hashConf) && objIntMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableQHashSeparateKVObjIntMapGO<K2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableQHashSeparateKVObjIntMapGO<K2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableQHashSeparateKVObjIntMapGO<K2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, Integer> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }
public static <K> void putAll(final InternalObjIntMapOps<K> map, Map<? extends K, ? extends Integer> another) { if (map == another) throw new IllegalArgumentException(); long maxPossibleSize = map.sizeAsLong() + Containers.sizeAsLong(another); map.ensureCapacity(maxPossibleSize); if (another instanceof ObjIntMap) { if (another instanceof InternalObjIntMapOps) { ((InternalObjIntMapOps) another).reversePutAllTo(map); } else { ((ObjIntMap) another).forEach(new ObjIntConsumer<K>() { @Override public void accept(K key, int value) { map.justPut(key, value); } }); } } else { for (Map.Entry<? extends K, ? extends Integer> e : another.entrySet()) { map.justPut(e.getKey(), e.getValue()); } } }
@Override @Nonnull public <K2 extends K> UpdatableLHashSeparateKVObjIntMapGO<K2> newUpdatableMap( Map<? extends K2, Integer> map, int expectedSize) { if (map instanceof ObjIntMap) { @SuppressWarnings("unchecked") ObjIntMap<K2> objIntMap = (ObjIntMap<K2>) map; if (map instanceof SeparateKVObjIntLHash) { SeparateKVObjIntLHash hash = (SeparateKVObjIntLHash) map; if (hash.hashConfig().equals(hashConf) && objIntMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableLHashSeparateKVObjIntMapGO<K2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableLHashSeparateKVObjIntMapGO<K2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableLHashSeparateKVObjIntMapGO<K2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, Integer> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }