1

So what would be elegant way to store key -- value if both are non unique, i need fifo but with option to access pair that was added as Nth. As far as I know maps won't do. I tought about using tab/list of two lists that would be key -- value determined by index but it doesn't sound "clean".

  • Yea You are right, that sounds way cleaner. I just had flip-flops on my eyes- wanted to use appropriate collection. Thank you! – Sławomir Skrouba Aug 04 '21 at 10:59
  • OK I'll post that as the answer for you to accept. Hope that is the correct way as I'm quite new here. – g00se Aug 04 '21 at 11:02

1 Answers1

0

That sounds not like a map entry but more like Pair<A, B> in which case, you need that as a custom class since there's no tuple/pair class in the JRE. The JRE Stack class will give you fifo that you can also treat as a List

g00se
  • 3,207
  • 2
  • 5
  • 9