I have an arraylist which is conformed of objects which have a name and a value so the arraylist is:
name value
A 1
B 10
C 23
D 45
How would you loop the ArrayList searching for 2 names like C and D, and get their respective values: 23, and 45?
Arraylistis not key->value like aHashMapor similar is. Your question makes no sense.ArrayList<Integer>orArrayList<String>, unless you've defined some kind of object that has both as instance variables. You might want to investigate theHashMap<ElemType, ElemType>collection class instead.