Answers for "iterate backwards java"

0

java iterator backwards

ArrayList<...> a = new ArrayList<...>();

// Add elements to list.

// Generate an iterator. Start just after the last element.
ListIterator li = a.listIterator(a.size());

// Iterate in reverse.
while(li.hasPrevious()) {
  System.out.println(li.previous());
}
Posted by: Guest on October-15-2020
1

how to iterate through an array backwards java

for (int counter = myArray.length - 1; counter >= 0; counter--) {
Posted by: Guest on December-28-2020

Code answers related to "iterate backwards java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language