public static boolean containsAllEntries(final InternalShortIntMapOps map, Map<?, ?> another) { if (map == another) throw new IllegalArgumentException(); if (another instanceof ShortIntMap) { ShortIntMap m2 = (ShortIntMap) another; if (map.size() < m2.size()) return false; if (m2 instanceof InternalShortIntMapOps) { //noinspection unchecked return ((InternalShortIntMapOps) m2).allEntriesContainingIn(map); } return m2.forEachWhile(new ShortIntPredicate() { @Override public boolean test(short a, int b) { return map.containsEntry(a, b); } }); } for (Map.Entry<?, ?> e : another.entrySet()) { if (!map.containsEntry((Short) e.getKey(), (Integer) e.getValue())) return false; } return true; }
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()); } } }
public static boolean containsAllEntries(final InternalShortIntMapOps map, Map<?, ?> another) { if (map == another) throw new IllegalArgumentException(); if (another instanceof ShortIntMap) { ShortIntMap m2 = (ShortIntMap) another; if (map.size() < m2.size()) return false; if (m2 instanceof InternalShortIntMapOps) { //noinspection unchecked return ((InternalShortIntMapOps) m2).allEntriesContainingIn(map); } return m2.forEachWhile(new ShortIntPredicate() { @Override public boolean test(short a, int b) { return map.containsEntry(a, b); } }); } for (Map.Entry<?, ?> e : another.entrySet()) { if (!map.containsEntry((Short) e.getKey(), (Integer) e.getValue())) return false; } return true; }