org.apache.commons.collections.iterators
Class ListIteratorWrapper

java.lang.Object
  |
  +--org.apache.commons.collections.iterators.ListIteratorWrapper
All Implemented Interfaces:
java.util.Iterator, java.util.ListIterator

public class ListIteratorWrapper
extends java.lang.Object
implements java.util.ListIterator

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

Since:
2.1
Version:
$Id: ListIteratorWrapper.java,v 1.2.2.1 2004/05/22 12:14:04 scolebourne Exp $
Author:
Morgan Delagrange, Stephen Colebourne

Constructor Summary
ListIteratorWrapper(java.util.Iterator iterator)
          Constructs a new ListIteratorWrapper that will wrap the given iterator.
 
Method Summary
 void add(java.lang.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.
 java.lang.Object next()
          Returns the next element from the iterator.
 int nextIndex()
          Returns in the index of the next element.
 java.lang.Object previous()
          Returns the the previous element.
 int previousIndex()
          Returns the index of the previous element.
 void remove()
          Throws UnsupportedOperationException.
 void set(java.lang.Object o)
          Throws UnsupportedOperationException.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListIteratorWrapper

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

Parameters:
iterator - the iterator to wrap
Throws:
java.lang.NullPointerException - if the iterator is null
Method Detail

add

public void add(java.lang.Object o)
         throws java.lang.UnsupportedOperationException
Throws UnsupportedOperationException.

Specified by:
add in interface java.util.ListIterator
Parameters:
o - ignored
Throws:
java.lang.UnsupportedOperationException - always

hasNext

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

Specified by:
hasNext in interface java.util.ListIterator
Returns:
true if there are more elements

hasPrevious

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

Specified by:
hasPrevious in interface java.util.ListIterator
Returns:
true if there are previous elements

next

public java.lang.Object next()
                      throws java.util.NoSuchElementException
Returns the next element from the iterator.

Specified by:
next in interface java.util.ListIterator
Returns:
the next element from the iterator
Throws:
java.util.NoSuchElementException - if there are no more elements

nextIndex

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

Specified by:
nextIndex in interface java.util.ListIterator
Returns:
the index of the next element

previous

public java.lang.Object previous()
                          throws java.util.NoSuchElementException
Returns the the previous element.

Specified by:
previous in interface java.util.ListIterator
Returns:
the previous element
Throws:
java.util.NoSuchElementException - if there are no previous elements

previousIndex

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

Specified by:
previousIndex in interface java.util.ListIterator
Returns:
the index of the previous element

remove

public void remove()
            throws java.lang.UnsupportedOperationException
Throws UnsupportedOperationException.

Specified by:
remove in interface java.util.ListIterator
Throws:
java.lang.UnsupportedOperationException - always

set

public void set(java.lang.Object o)
         throws java.lang.UnsupportedOperationException
Throws UnsupportedOperationException.

Specified by:
set in interface java.util.ListIterator
Parameters:
o - ignored
Throws:
java.lang.UnsupportedOperationException - always


Copyright © 2001-2004 The Apache Software Foundation. All Rights Reserved.