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