798 |
|
return result; |
799 |
|
} |
800 |
|
|
801 |
+ |
public Iterator<E> descendingIterator() { |
802 |
+ |
return new DescendingIterator(); |
803 |
+ |
} |
804 |
+ |
|
805 |
+ |
/** Adapter to provide descending iterators via ListItr.previous */ |
806 |
+ |
private class DescendingIterator implements Iterator { |
807 |
+ |
final ListItr itr = new ListItr(size()); |
808 |
+ |
public boolean hasNext() { |
809 |
+ |
return itr.hasPrevious(); |
810 |
+ |
} |
811 |
+ |
public E next() { |
812 |
+ |
return itr.previous(); |
813 |
+ |
} |
814 |
+ |
public void remove() { |
815 |
+ |
itr.remove(); |
816 |
+ |
} |
817 |
+ |
} |
818 |
+ |
|
819 |
|
/** |
820 |
|
* Returns a shallow copy of this <tt>LinkedList</tt>. (The elements |
821 |
|
* themselves are not cloned.) |