I have a list:
public static List<String> codes = new LinkedList<String>(Arrays.asList(
"Zero",
"One"
)); //Etc..
I want to be able to find the number of a String's position when I type it. For instance, if I type One, I want the program to print out 1. Currently, I can only do the reverse by using codes.get();
Correction: I want the program to print out the position of the String in the list. Zero has the position 0, if I do codes.get(0); I get Zero. But how do I do the reverse?
Is there a way to smoothly do this? Thanks in advance.
Get element by indexvsget index by element:)Listapi is here