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