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