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