Is there a way to create an IdentityMap in scala 2.8

It used to be IdentityHashMapin collection.jcl: is there a way to create the same thing in the new set library 2.8 (possibly using an equality relation)?

+3
source share
1 answer

There scala.collection.mutable.HashMapare two protected methods, elemEqualsand elemHashCode. If you override them, you can create your own IdentityHashMap.

There scala.collection.immutable.HashMapis only elemHashCode. (I don't know why, carelessly.)

+4
source

Source: https://habr.com/ru/post/1755780/


All Articles