org.apache.commons.collections.iterators

Class ListIteratorWrapper

public class ListIteratorWrapper extends Object implements ListIterator

As the wrapped Iterator is traversed, ListIteratorWrapper builds a LinkedList of its values, permitting all required operations of ListIterator.

Since: Commons Collections 2.1

Version: $Revision: 1.7 $ $Date: 2004/02/18 00:59:50 $

Author: Morgan Delagrange Stephen Colebourne

Constructor Summary
ListIteratorWrapper(Iterator iterator)
Constructs a new ListIteratorWrapper that will wrap the given iterator.
Method Summary
voidadd(Object o)
Throws {@link UnsupportedOperationException}.
booleanhasNext()
Returns true if there are more elements in the iterator.
booleanhasPrevious()
Returns true if there are previous elements in the iterator.
Objectnext()
Returns the next element from the iterator.
intnextIndex()
Returns in the index of the next element.
Objectprevious()
Returns the the previous element.
intpreviousIndex()
Returns the index of the previous element.
voidremove()
Throws {@link UnsupportedOperationException}.
voidset(Object o)
Throws {@link UnsupportedOperationException}.

Constructor Detail

ListIteratorWrapper

public ListIteratorWrapper(Iterator iterator)
Constructs a new ListIteratorWrapper that will wrap the given iterator.

Parameters: iterator the iterator to wrap

Throws: NullPointerException if the iterator is null

Method Detail

add

public void add(Object o)
Throws {@link UnsupportedOperationException}.

Parameters: o ignored

Throws: UnsupportedOperationException always

hasNext

public boolean hasNext()
Returns true if there are more elements in the iterator.

Returns: true if there are more elements

hasPrevious

public boolean hasPrevious()
Returns true if there are previous elements in the iterator.

Returns: true if there are previous elements

next

public Object next()
Returns the next element from the iterator.

Returns: the next element from the iterator

Throws: NoSuchElementException if there are no more elements

nextIndex

public int nextIndex()
Returns in the index of the next element.

Returns: the index of the next element

previous

public Object previous()
Returns the the previous element.

Returns: the previous element

Throws: NoSuchElementException if there are no previous elements

previousIndex

public int previousIndex()
Returns the index of the previous element.

Returns: the index of the previous element

remove

public void remove()
Throws {@link UnsupportedOperationException}.

Throws: UnsupportedOperationException always

set

public void set(Object o)
Throws {@link UnsupportedOperationException}.

Parameters: o ignored

Throws: UnsupportedOperationException always

Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.