Guava biMap for bi directional map, but do we have any thread safe bi directional map?

276 Views Asked by At

Guava biMap for bi directional map, but do we have any thread safe bi directional map ?

1

There are 1 best solutions below

0
Donald Raab On

There is Maps.synchronizedBiMap(BiMap) in Guava which provides some conditional level of thread-safety. The JavaDoc warns that you will have to manually synchronize on the map when using any of the views.

You could also use an ImmutableBiMap which should be thread-safe.