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,209
  • 1
  • 16
  • 31

2 Answers2

1

Two popular choices are

Xipo
  • 1,765
  • 1
  • 16
  • 23
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,517
  • 19
  • 24