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()); } } }
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()); } } }