Eugene Eugene - 6 months ago 17
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();
}