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