I'm looking for a class in java that has key-value association, but without using hashes. Here is what I'm currently doing:
- Add values to a Hashtable
- Get an iterator for the Hashtable.entrySet().
- Iterate through all values and:
- Get a Map.Entry for the iterator
- Create an object of type Module (a custom class) based on the value.
- Add the class to a JPanel;
- Show the panel.
The problem with this is that I do not have control over the order that I get the values back, so I cannot display the values in the a given order (without hard-coding the order).
I would use an ArrayList or Vector for this, but later in the code I need to grab the Module object for a given Key, which I can't do with an ArrayList or Vector.
Does anyone know of a free/open-source Java class that will do this, or a way to get values out of a Hashtable based on when they were added?
Thanks!