Anyone know if Guava has an equivalent version to Functionaljava's HashMap?
Map equals() method in Java with Examples Map. equals() method in Java is used to check for equality between two maps. It verifies whether the elements of one map passed as a parameter is equal to the elements of this map or not.
As far as I know, no.
But you can wrap all your keys in Equivalence.Wrapper
instances using the Equivalence
strategy you need:
Equivalence<K> equiv = ...
Map<Equivalence.Wrapper<K>, V> map = ...
map.put(equiv.wrap(key), value);
Of course this means you need an additional object for every entry in your map. Thus I think a map implementation like you suggest would be nice to have.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With