ObjObjMap m2 = (ObjObjMap) another; if ( m2.keyEquivalence().equals(map.keyEquivalence()) && m2.valueEquivalence().equals(map.valueEquivalence()) ) { if (map.size() < m2.size()) return false; if (m2 instanceof InternalObjObjMapOps) { return m2.forEachWhile(new BiPredicate() { @Override
public static <K, V> void putAll(final InternalObjObjMapOps<K, V> map, Map<? extends K, ? extends V> another) { if (map == another) throw new IllegalArgumentException(); long maxPossibleSize = map.sizeAsLong() + Containers.sizeAsLong(another); map.ensureCapacity(maxPossibleSize); if (another instanceof ObjObjMap) { if (another instanceof InternalObjObjMapOps) { ((InternalObjObjMapOps) another).reversePutAllTo(map); } else { ((ObjObjMap) another).forEach(new BiConsumer<K, V>() { @Override public void accept(K key, V value) { map.justPut(key, value); } }); } } else { for (Map.Entry<? extends K, ? extends V> e : another.entrySet()) { map.justPut(e.getKey(), e.getValue()); } } }
@Override @Nonnull public <K2 extends K, V2 extends V> UpdatableQHashParallelKVObjObjMapGO<K2, V2> newUpdatableMap( Map<? extends K2, ? extends V2> map, int expectedSize) { if (map instanceof ObjObjMap) { @SuppressWarnings("unchecked") ObjObjMap<K2, V2> objObjMap = (ObjObjMap<K2, V2>) map; if (map instanceof ParallelKVObjObjQHash) { ParallelKVObjObjQHash hash = (ParallelKVObjObjQHash) map; if (hash.hashConfig().equals(hashConf) && objObjMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableQHashParallelKVObjObjMapGO<K2, V2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableQHashParallelKVObjObjMapGO<K2, V2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableQHashParallelKVObjObjMapGO<K2, V2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, ? extends V2> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }
@Override @Nonnull public <K2 extends K, V2 extends V> UpdatableQHashParallelKVObjObjMapGO<K2, V2> newUpdatableMap( Map<? extends K2, ? extends V2> map, int expectedSize) { if (map instanceof ObjObjMap) { @SuppressWarnings("unchecked") ObjObjMap<K2, V2> objObjMap = (ObjObjMap<K2, V2>) map; if (map instanceof ParallelKVObjObjQHash) { ParallelKVObjObjQHash hash = (ParallelKVObjObjQHash) map; if (hash.hashConfig().equals(hashConf) && objObjMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableQHashParallelKVObjObjMapGO<K2, V2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableQHashParallelKVObjObjMapGO<K2, V2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableQHashParallelKVObjObjMapGO<K2, V2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, ? extends V2> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }
ObjObjMap m2 = (ObjObjMap) another; if ( m2.keyEquivalence().equals(map.keyEquivalence()) && m2.valueEquivalence().equals(map.valueEquivalence()) ) { if (map.size() < m2.size()) return false; if (m2 instanceof InternalObjObjMapOps) { return m2.forEachWhile(new BiPredicate() { @Override
@Override @Nonnull public <K2 extends K, V2 extends V> UpdatableLHashParallelKVObjObjMapGO<K2, V2> newUpdatableMap( Map<? extends K2, ? extends V2> map, int expectedSize) { if (map instanceof ObjObjMap) { @SuppressWarnings("unchecked") ObjObjMap<K2, V2> objObjMap = (ObjObjMap<K2, V2>) map; if (map instanceof ParallelKVObjObjLHash) { ParallelKVObjObjLHash hash = (ParallelKVObjObjLHash) map; if (hash.hashConfig().equals(hashConf) && objObjMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableLHashParallelKVObjObjMapGO<K2, V2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableLHashParallelKVObjObjMapGO<K2, V2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableLHashParallelKVObjObjMapGO<K2, V2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, ? extends V2> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }
public static <K, V> void putAll(final InternalObjObjMapOps<K, V> map, Map<? extends K, ? extends V> another) { if (map == another) throw new IllegalArgumentException(); long maxPossibleSize = map.sizeAsLong() + Containers.sizeAsLong(another); map.ensureCapacity(maxPossibleSize); if (another instanceof ObjObjMap) { if (another instanceof InternalObjObjMapOps) { ((InternalObjObjMapOps) another).reversePutAllTo(map); } else { ((ObjObjMap) another).forEach(new BiConsumer<K, V>() { @Override public void accept(K key, V value) { map.justPut(key, value); } }); } } else { for (Map.Entry<? extends K, ? extends V> e : another.entrySet()) { map.justPut(e.getKey(), e.getValue()); } } }
@Override @Nonnull public <K2 extends K, V2 extends V> UpdatableLHashParallelKVObjObjMapGO<K2, V2> newUpdatableMap( Map<? extends K2, ? extends V2> map, int expectedSize) { if (map instanceof ObjObjMap) { @SuppressWarnings("unchecked") ObjObjMap<K2, V2> objObjMap = (ObjObjMap<K2, V2>) map; if (map instanceof ParallelKVObjObjLHash) { ParallelKVObjObjLHash hash = (ParallelKVObjObjLHash) map; if (hash.hashConfig().equals(hashConf) && objObjMap.keyEquivalence().equals(getKeyEquivalence())) { UpdatableLHashParallelKVObjObjMapGO<K2, V2> res = uninitializedUpdatableMap(); res.copy(hash); return res; } } UpdatableLHashParallelKVObjObjMapGO<K2, V2> res = newUpdatableMap(expectedSize); res.putAll(map); return res; } else { UpdatableLHashParallelKVObjObjMapGO<K2, V2> res = newUpdatableMap(expectedSize); for (Map.Entry<? extends K2, ? extends V2> entry : map.entrySet()) { res.put(entry.getKey(), entry.getValue()); } return res; } } }