Eugene Eugene - 3 months ago 9
Java Question

Skip the first item while iteration through List

I need to skip the very first item iterating through the

List
.

for (MyClass myObject : myList) {
myObject.doSomething();
}

Answer

Something like:

for (MyClass myObject : myList.subList(1, myList.size()) {
       myObject.doSomething();
}