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