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