Solution: use a card
Um, you might need a Map ?
Map<String,Integer> map = new HashMap<String,Integer>();
map.put("Some String", 42);
map.put("Some String", Integer.valueOf(42));
You can search using
Integer result = map.get("Some String");
: Sun Java Tutorial > > Interfaces >
OP
, . , , ( ):
Object[] entry = new Object[]{"Some String",Integer.valueOf(42)};
List<Object[]> myList = new ArrayList<Object[]>();
myList.add(entry);
:
for(final Object[] candidate : myList){
if("Some String".equals(candidate[0])){
System.out.println("Result: " + candidate[1]);
break;
}
}
, , . . .