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