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