Welcome to this Blog. I am Software Engineer and work for Zühlke Engineering AG in Bern. This is my private blog, in which I will post mainly about technical stuff like Software Engineering or IT related topics. The views expressed herein do not necessarily represent those of my employer.

 

 
 

 

Today, I had the problem to iterate backwards in a ArrayList. Didn’t know, there is a ListIterator:

List<String> theList = new ArrayList<String>(); 
theList.add("a"); 
theList.add("b"); 
theList.add("c"); 
ListIterator<String> liter = theList.listIterator(theList.size()); 
while (liter.hasPrevious()) { 
  System.out.println(liter.previous()); 
}

 

 

 

 

 
Leave a comment