Small CODE snippet I found today...
-
public String getName(int id) throws Exception {
ArrayList contents = getContents();
ActionDTO action = (ActionDTO)contents.get(id - 1);
return action.getActionName();
}for the record getContents makes no guarantees on the order of whats returned. Even if it did that alone wouldn't be enough to make this reliable.
-
I have a system like this! It's my wallet. Sadly, it's a zero-based wallet, so in order to retrieve the first dollar, I have to subtract one from it.