Youssef Shoaib [MOD]
05/13/2025, 1:53 PMMutableMap<MyKey, Any?>
, where MyKey
is an empty class completely within my control. Is there some way to have "perfect hashing" here by modifying MyKey
to use some custom hashcodes?Sam
05/13/2025, 2:47 PMephemient
05/13/2025, 2:47 PMhashCode()
, although there's no guarantee that HashMap
will use the correct number of buckets or the right bucket distributionephemient
05/13/2025, 2:48 PMMutableMap
class you could guarantee thatephemient
05/13/2025, 2:50 PMAbstractMutableMap
is not straightforward, as the interface requires it to be intertwined with entries: MutableSet<MutableEntry>
which will likely need to be a custom AbstractMutableSet
too)