public static boolean containsAllEntries(final InternalByteFloatMapOps map, Map<?, ?> another) { if (map == another) throw new IllegalArgumentException(); if (another instanceof ByteFloatMap) { ByteFloatMap m2 = (ByteFloatMap) another; if (map.size() < m2.size()) return false; if (m2 instanceof InternalByteFloatMapOps) { //noinspection unchecked return ((InternalByteFloatMapOps) m2).allEntriesContainingIn(map); } return m2.forEachWhile(new ByteFloatPredicate() { @Override public boolean test(byte a, float b) { return map.containsEntry(a, b); } }); } for (Map.Entry<?, ?> e : another.entrySet()) { if (!map.containsEntry((Byte) e.getKey(), (Float) e.getValue())) return false; } return true; }
public static boolean containsAllEntries(final InternalByteFloatMapOps map, Map<?, ?> another) { if (map == another) throw new IllegalArgumentException(); if (another instanceof ByteFloatMap) { ByteFloatMap m2 = (ByteFloatMap) another; if (map.size() < m2.size()) return false; if (m2 instanceof InternalByteFloatMapOps) { //noinspection unchecked return ((InternalByteFloatMapOps) m2).allEntriesContainingIn(map); } return m2.forEachWhile(new ByteFloatPredicate() { @Override public boolean test(byte a, float b) { return map.containsEntry(a, b); } }); } for (Map.Entry<?, ?> e : another.entrySet()) { if (!map.containsEntry((Byte) e.getKey(), (Float) e.getValue())) return false; } return true; }