capturedme
Programmer
Hi everyone. I have coded a simple program that is supposed to display the objects in the iterator, and as is, it does. I am trying to figure out a way to reverse the values so they read "Three, Two, One" instead of the other way around. Is there a way to do this without using a listiterator? Thanks a lot. Any help is appreciated.
Code:
import java.util.*;
public class Reverse {
public static void main(String[] args) {
List myList = new LinkedList();
myList.add("One");
myList.add("Two");
myList.add("Three");
for (int i = myList.size(); i >= 0; i--) {
System.out.println(myList.toString());
}
}
}