@Override
    public boolean equals(Object o) {
        if (o == this)
            return true;
        if (!(o instanceof Map))
            return false;
        Map<?, ?> m = (Map<?, ?>) o;
        if (m.size() != size())
            return false;
        try {
            for (Entry<K, V> entry : entrySet()) {
                if (!m.get(entry.getKey()).equals(entry.getValue())) {
                    return false;
                }
            }
        } catch (ClassCastException unused) {
            return false;
        }
        return true;

    }
This is a hash map which can be snapshotted.
<br>
See {@link SnapshottableHashTable} for more details about the implementation.
<br>
This class requires external synchronization.  Null keys and values are not supported.

@param <K>   The key type of the set.
@param <V>   The value type of the set.
server-common/src/main/java/org/apache/kafka/timeline/TimelineHashMap.java