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