1 16 package org.apache.myfaces.util; 17 18 import java.util.Iterator ; 19 import java.util.List ; 20 import java.util.NoSuchElementException ; 21 22 36 public class ReverseListIterator 37 implements Iterator 38 { 39 41 private int _cursor; 42 private List _list; 43 44 public ReverseListIterator(List list) 45 { 46 _list = list; 47 _cursor = list.size() - 1; 48 } 49 50 public boolean hasNext() 51 { 52 return _cursor >= 0; 53 } 54 55 public Object next() 56 { 57 if (_cursor < 0) 58 { 59 throw new NoSuchElementException (); 60 } 61 return _list.get(_cursor--); 62 } 63 64 public void remove() 65 { 66 throw new UnsupportedOperationException (); 67 } 68 69 } 70 | Popular Tags |