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 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; }