Answer the question
In order to leave comments, you need to log in
What structure to store three related values to use in Java?
Good afternoon, habralyudi!
Now in our project we use the usual HashMap to store key-value data (in fact, value-value, since the key itself is also used and there is always a complete enumeration of all elements).
At the moment, it was required to store a third value. What is the best structure to use for a triple of related values (value-value-value)?
So far, I've thought of creating a class that stores all 3 values, and creating an ArrayList from objects of this class.
Answer the question
In order to leave comments, you need to log in
And if you push a pair as a value in HashMap? And wrap it all up in an adapter for convenience.
Still, if you need a HashMap (quick access), then ArrayList is a problem.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question