public static void putAll(final InternalLongShortMapOps map, Map<? extends Long, ? extends Short> another) { if (map == another) throw new IllegalArgumentException(); long maxPossibleSize = map.sizeAsLong() + Containers.sizeAsLong(another); map.ensureCapacity(maxPossibleSize); if (another instanceof LongShortMap) { if (another instanceof InternalLongShortMapOps) { ((InternalLongShortMapOps) another).reversePutAllTo(map); } else { ((LongShortMap) another).forEach(new LongShortConsumer() { @Override public void accept(long key, short value) { map.justPut(key, value); } }); } } else { for (Map.Entry<? extends Long, ? extends Short> e : another.entrySet()) { map.justPut(e.getKey(), e.getValue()); } } }
public static void putAll(final InternalLongShortMapOps map, Map<? extends Long, ? extends Short> another) { if (map == another) throw new IllegalArgumentException(); long maxPossibleSize = map.sizeAsLong() + Containers.sizeAsLong(another); map.ensureCapacity(maxPossibleSize); if (another instanceof LongShortMap) { if (another instanceof InternalLongShortMapOps) { ((InternalLongShortMapOps) another).reversePutAllTo(map); } else { ((LongShortMap) another).forEach(new LongShortConsumer() { @Override public void accept(long key, short value) { map.justPut(key, value); } }); } } else { for (Map.Entry<? extends Long, ? extends Short> e : another.entrySet()) { map.justPut(e.getKey(), e.getValue()); } } }