public static boolean containsAllEntries(final InternalShortLongMapOps map, Map<?, ?> another) { if (map == another) throw new IllegalArgumentException(); if (another instanceof ShortLongMap) { ShortLongMap m2 = (ShortLongMap) another; if (map.size() < m2.size()) return false; if (m2 instanceof InternalShortLongMapOps) { //noinspection unchecked return ((InternalShortLongMapOps) m2).allEntriesContainingIn(map); } return m2.forEachWhile(new ShortLongPredicate() { @Override public boolean test(short a, long b) { return map.containsEntry(a, b); } }); } for (Map.Entry<?, ?> e : another.entrySet()) { if (!map.containsEntry((Short) e.getKey(), (Long) e.getValue())) return false; } return true; }
public static boolean containsAllEntries(final InternalShortLongMapOps map, Map<?, ?> another) { if (map == another) throw new IllegalArgumentException(); if (another instanceof ShortLongMap) { ShortLongMap m2 = (ShortLongMap) another; if (map.size() < m2.size()) return false; if (m2 instanceof InternalShortLongMapOps) { //noinspection unchecked return ((InternalShortLongMapOps) m2).allEntriesContainingIn(map); } return m2.forEachWhile(new ShortLongPredicate() { @Override public boolean test(short a, long b) { return map.containsEntry(a, b); } }); } for (Map.Entry<?, ?> e : another.entrySet()) { if (!map.containsEntry((Short) e.getKey(), (Long) e.getValue())) return false; } return true; }