Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.collections.iterators
Class ListIteratorWrapper

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

All Implemented Interfaces:
  Iterator, ListIterator

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
`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`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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 UnsupportedOperationException

  Throws `UnsupportedOperationException`.

  Specified by:
    `add` in interface `ListIterator`
  Parameters:
    `o` - ignored
  Throws:
    `UnsupportedOperationException` - always

### hasNext

    public boolean hasNext()

  Returns true if there are more elements in the iterator.

  Specified by:
    `hasNext` in interface `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 `ListIterator`
  Returns:
    true if there are previous elements

### next

    public Object next()
                throws NoSuchElementException

  Returns the next element from the iterator.

  Specified by:
    `next` in interface `ListIterator`
  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.

  Specified by:
    `nextIndex` in interface `ListIterator`
  Returns:
    the index of the next element

### previous

    public Object previous()
                    throws NoSuchElementException

  Returns the the previous element.

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

### previousIndex

    public int previousIndex()

  Returns the index of the previous element.

  Specified by:
    `previousIndex` in interface `ListIterator`
  Returns:
    the index of the previous element

### remove

    public void remove()
                throws UnsupportedOperationException

  Throws `UnsupportedOperationException`.

  Specified by:
    `remove` in interface `ListIterator`
  Throws:
    `UnsupportedOperationException` - always

### set

    public void set(Object o)
             throws UnsupportedOperationException

  Throws `UnsupportedOperationException`.

  Specified by:
    `set` in interface `ListIterator`
  Parameters:
    `o` - ignored
  Throws:
    `UnsupportedOperationException` - always

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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