Help me, please, to get right collection implementation

I'm in anxiety about what kind of collection I need to choose:
I need to store String names and map them to indecies.
Than I need to get index of name by provide name to collection's method.
I think that HashMap will be big, because List may store objects and have indecies, but I can find an appropriate method to get name index if I want. (except iterate via list elements using iterator).
What do you think will be the best?

I'm in anxiety about what kind of collection I need
to choose:
I need to store String names and map them to
indecies.
Than I need to get index of name by provide name to
collection's method.
I think that HashMap will be big, because List may
store objects and have indecies, but I can find an
appropriate method to get name index if I want.
(except iterate via list elements using iterator).
What do you think will be the best?I vote for java.util.List:
List<String> values = new ArrayList<String>();
String thisValue = "some String that's indexed";
values.add(thisValue);
int thisIndex = values.indexOf(thisValue);Read the javadocs.
%

Similar Messages

Maybe you are looking for