How can I start the index in an ArrayList at 1 instead of 0? Is there a way to do that directly in code?
ArrayList
(Note that I am asking for ArrayList
Well, you could make your own:
public class MyArrayList extends ArrayList { public T get(int index) { super.get(index - 1); } public void set(int index, T value) { super.set(index - 1, value); } }
But it begs the question: why on earth would you bother?