⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
org.apache.commons.collections.iterators

Class ListIteratorWrapper

java.lang.Object
|
+--org.apache.commons.collections.iterators.ListIteratorWrapper

All Implemented Interfaces:
ListIterator


public class ListIteratorWrapper
extends java.lang.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
Authors:
Morgan Delagrange
Stephen Colebourne

Constructor Summary

ListIteratorWrapper(Iterator iterator)

Constructs a new ListIteratorWrapper that will wrap the given iterator.

Method Summary

void

add(Object o)

Throws UnsupportedOperationException.

boolean

hasNext()

Returns true if there are more elements in the iterator.

boolean

hasPrevious()

Returns true if there are previous elements in the iterator.

Object

next()

Returns the next element from the iterator.

int

nextIndex()

Returns in the index of the next element.

Object

previous()

Returns the the previous element.

int

previousIndex()

Returns the index of the previous element.

void

remove()

Throws UnsupportedOperationException.

void

set(Object o)

Throws UnsupportedOperationException.

Constructor Details

ListIteratorWrapper

public ListIteratorWrapper(Iterator iterator)

Constructs a new ListIteratorWrapper that will wrap the given iterator.

Parameters:
iterator - the iterator to wrap
Throws:
- if the iterator is null

Method Details

add

public void add(Object o)

Throws UnsupportedOperationException.

Parameters:
o - ignored
Throws:
- 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:
- 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:
- 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 UnsupportedOperationException.

Throws:
- always

set

public void set(Object o)

Throws UnsupportedOperationException.

Parameters:
o - ignored
Throws:
- always