public static boolean containsAllEntries(final InternalShortShortMapOps map, Map<?, ?> another) { if (map == another) throw new IllegalArgumentException(); if (another instanceof ShortShortMap) { ShortShortMap m2 = (ShortShortMap) another; if (map.size() < m2.size()) return false; if (m2 instanceof InternalShortShortMapOps) { //noinspection unchecked return ((InternalShortShortMapOps) m2).allEntriesContainingIn(map); } return m2.forEachWhile(new ShortShortPredicate() { @Override public boolean test(short a, short b) { return map.containsEntry(a, b); } }); } for (Map.Entry<?, ?> e : another.entrySet()) { if (!map.containsEntry((Short) e.getKey(), (Short) e.getValue())) return false; } return true; }
public static void putAll(final InternalShortShortMapOps map, Map<? extends Short, ? extends Short> another) { if (map == another) throw new IllegalArgumentException(); long maxPossibleSize = map.sizeAsLong() + Containers.sizeAsLong(another); map.ensureCapacity(maxPossibleSize); if (another instanceof ShortShortMap) { if (another instanceof InternalShortShortMapOps) { ((InternalShortShortMapOps) another).reversePutAllTo(map); } else { ((ShortShortMap) another).forEach(new ShortShortConsumer() { @Override public void accept(short key, short value) { map.justPut(key, value); } }); } } else { for (Map.Entry<? extends Short, ? extends Short> e : another.entrySet()) { map.justPut(e.getKey(), e.getValue()); } } }
public static void putAll(final InternalShortShortMapOps map, Map<? extends Short, ? extends Short> another) { if (map == another) throw new IllegalArgumentException(); long maxPossibleSize = map.sizeAsLong() + Containers.sizeAsLong(another); map.ensureCapacity(maxPossibleSize); if (another instanceof ShortShortMap) { if (another instanceof InternalShortShortMapOps) { ((InternalShortShortMapOps) another).reversePutAllTo(map); } else { ((ShortShortMap) another).forEach(new ShortShortConsumer() { @Override public void accept(short key, short value) { map.justPut(key, value); } }); } } else { for (Map.Entry<? extends Short, ? extends Short> e : another.entrySet()) { map.justPut(e.getKey(), e.getValue()); } } }
public static boolean containsAllEntries(final InternalShortShortMapOps map, Map<?, ?> another) { if (map == another) throw new IllegalArgumentException(); if (another instanceof ShortShortMap) { ShortShortMap m2 = (ShortShortMap) another; if (map.size() < m2.size()) return false; if (m2 instanceof InternalShortShortMapOps) { //noinspection unchecked return ((InternalShortShortMapOps) m2).allEntriesContainingIn(map); } return m2.forEachWhile(new ShortShortPredicate() { @Override public boolean test(short a, short b) { return map.containsEntry(a, b); } }); } for (Map.Entry<?, ?> e : another.entrySet()) { if (!map.containsEntry((Short) e.getKey(), (Short) e.getValue())) return false; } return true; }