Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsEmptyListIteratorExample3 { public static void main(String[] args) { List
ls = new ArrayList
(); ls.add(1); ls.add(2); ListIterator
Itr = Collections.emptyListIterator(); System.out.println(Itr.nextIndex()); System.out.println(Itr.previousIndex()); System.out.println("nextIndex() and previousIndex() always returns 0 and -1."); } }
Output