I need a class being HashMap and ArrayList at the same time.
Why do I need HashMap? To get quick access to the object basing on the key.
Why do I need ArrayList? To randomly select one element.
Do you have any idea how to solve this? Is there any ready class from the shelf?
As for now the only solution which comes to my mind is to use ArrayList. Then random access is a piece of cake. And for selecting object basing on the key just using a simple iterator is some kind of solution but far from being perfect....
keys?ArrayListand use the list for the random selection. No need for a hybrid container IMO. But maybe you can elaborate on exactly what usage scenario you are applying this to.