3

I would need a list/map like a HashMap where i can easily access either 'side' by simple passing the object and retrieving the other thing.

I need to be able to use get(key) and retrieve the value as well as get(value) and retrieve the key AND i want to be able to set a new key or value.

Is there already something like that ?

NikkyD
  • 2,127
  • 1
  • 14
  • 30

2 Answers2

1

Two popular choices are

Xipo
  • 1,625
  • 1
  • 17
  • 22
0

There's no built-in data type for this. You can use Guava's BiMap and do this with reverse() function. See this.

Sezin Karli
  • 2,487
  • 18
  • 24