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

## umontreal.iro.lecuyer.collections
Class FilteredListIterator<E>

    java.lang.Object
      umontreal.iro.lecuyer.collections.FilteredIterator<E>
          umontreal.iro.lecuyer.collections.FilteredListIterator<E>

Type Parameters:
  `E` - the type of the accepted objects.

All Implemented Interfaces:
  Iterator<E>, ListIterator<E>

Direct Known Subclasses:
  ObjectTypeListIterator

    public abstract class FilteredListIterator<E>

extends FilteredIterator<E>
implements ListIterator<E>

Represents a list iterator traversing a restricted subset of the elements enumerated by another list iterator. A filtered list iterator encapsulates an ordinary list iterator, and uses it to enumerate objects. However, this iterator only returns objects passing the test implemented in the user-defined `FilteredIterator.filter(java.lang.Object)` method. For example, this class could be used to iterate over objects of a certain subclass or having certain properties. Note that this iterator does not support the `add(E)`, `set(E)`, and `remove()` operations.

Constructor Summary
`FilteredListIterator(ListIterator<? super E> it)` Constructs a new filtered iterator from the iterator `it`.
`FilteredListIterator(ListIterator<? super E> it, int maxNumElements)` Constructs a new filtered iterator from the iterator `it`, and returning at most `maxNumElements` elements.

Method Summary
`void` | `add(E o)`
`ListIterator<? super E>` | `getInnerIterator()` Returns the inner iterator used by this iterator.
`boolean` | `hasNext()`
`boolean` | `hasPrevious()`
`E` | `next()`
`int` | `nextIndex()`
`E` | `previous()`
`int` | `previousIndex()`
`void` | `remove()`
`void` | `set(E o)`

Methods inherited from class umontreal.iro.lecuyer.collections.FilteredIterator
`filter, getMaxNumElements`

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

Constructor Detail

### FilteredListIterator

    public FilteredListIterator(ListIterator<? super E> it)

  Constructs a new filtered iterator from the iterator `it`. Note that if `it` is not positionned at the beginning of the list, this method has to enumerate all elements of `it` to set the initial value of `nextIndex()`.

  Parameters:
    `it` - the iterator being filtered.
  Throws:
    `NullPointerException` - if `it` is `null`.

### FilteredListIterator

    public FilteredListIterator(ListIterator<? super E> it,
                                int maxNumElements)

  Constructs a new filtered iterator from the iterator `it`, and returning at most `maxNumElements` elements. Note that if `it` is not positionned at the beginning of the list, this method has to enumerate all elements of `it` to set the initial value of `nextIndex()`, which cannot exceed `maxNumElements`.

  Parameters:
    `it` - the iterator being filtered.
    `maxNumElements` - the maximal number of elements the iterator can return.
  Throws:
    `NullPointerException` - if `it` is `null`.
    `IllegalArgumentException` - if `maxNumElements` is negative.

Method Detail

### getInnerIterator

    public ListIterator<? super E> getInnerIterator()

  Returns the inner iterator used by this iterator.

  Overrides:
    `getInnerIterator` in class `FilteredIterator<E>`
  Returns:
    the inner iterator.

### add

    public void add(E o)

  Specified by:
    `add` in interface `ListIterator<E>`

### hasNext

    public boolean hasNext()

  Specified by:
    `hasNext` in interface `Iterator<E>`
  Specified by:
    `hasNext` in interface `ListIterator<E>`
  Overrides:
    `hasNext` in class `FilteredIterator<E>`

### hasPrevious

    public boolean hasPrevious()

  Specified by:
    `hasPrevious` in interface `ListIterator<E>`

### nextIndex

    public int nextIndex()

  Specified by:
    `nextIndex` in interface `ListIterator<E>`

### previous

    public E previous()

  Specified by:
    `previous` in interface `ListIterator<E>`

### next

    public E next()

  Specified by:
    `next` in interface `Iterator<E>`
  Specified by:
    `next` in interface `ListIterator<E>`
  Overrides:
    `next` in class `FilteredIterator<E>`

### previousIndex

    public int previousIndex()

  Specified by:
    `previousIndex` in interface `ListIterator<E>`

### set

    public void set(E o)

  Specified by:
    `set` in interface `ListIterator<E>`

### remove

    public void remove()

  Specified by:
    `remove` in interface `Iterator<E>`
  Specified by:
    `remove` in interface `ListIterator<E>`
  Overrides:
    `remove` in class `FilteredIterator<E>`

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

To submit a bug or ask questions, send an e-mail to Richard Simard.