What is the cleanest way to increment an Integer in an ArrayList?
ArrayList<Integer> ints = new ArrayList<>();
ints.add(5);
ints.add(9);
What is the cleanest way to increment the last element?
ints.set(ints.size() - 1, ints.get(ints.size() - 1) + 1); seems pretty ugly to me.