I am interested in using a Map that will contain unique keys and values. I also would like to have O(1) complexity for .containsKey()
and .containsValue()
. To me, it seems like a HashBiMap
should be able to support this complexity because of the uniqueness of both the keys and values in the map and hashing. Is this a correct assumption?
A PROPERLY IMPLEMENTED two-way HashMap
(In this case, a HashBiMap
) indeed has a runtime complexity of O(1) for containsKey
and containsValue
.