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