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

Class FilterListIterator

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

All Implemented Interfaces:
ListIterator


public class FilterListIterator
extends java.lang.Object
implements ListIterator

A proxy ListIterator ListIterator which takes a Predicate Predicate instance to filter out objects from an underlying ListIterator instance. Only objects for which the specified Predicate evaluates to true are returned by the iterator.
Since:
Commons Collections 2.0
Author:
Rodney Waldhoff

Constructor Summary

FilterListIterator()

Constructs a new FilterListIterator that will not function until ProxyListIterator#setListIterator(ListIterator) setListIterator and #setPredicate(Predicate) setPredicate are invoked.

FilterListIterator(ListIterator iterator)

Constructs a new FilterListIterator that will not function until #setPredicate(Predicate) setPredicate is invoked.

FilterListIterator(ListIterator iterator, Predicate predicate)

Constructs a new FilterListIterator.

FilterListIterator(Predicate predicate)

Constructs a new FilterListIterator that will not function until ProxyListIterator#setListIterator(ListIterator) setListIterator is invoked.

Method Summary

void

add(Object o)

Not supported.

ListIterator

getListIterator()

Gets the iterator this iterator is using.

Predicate

getPredicate()

Gets the predicate this iterator is using.

boolean

hasNext()

boolean

hasPrevious()

Object

next()

int

nextIndex()

Object

previous()

int

previousIndex()

void

remove()

Not supported.

void

set(Object o)

Not supported.

void

setListIterator(ListIterator iterator)

Sets the iterator for this iterator to use.

void

setPredicate(Predicate predicate)

Sets the predicate this the iterator to use.

Constructor Details

FilterListIterator

public FilterListIterator()

Constructs a new FilterListIterator that will not function until ProxyListIterator.setListIterator(ListIterator) and setPredicate(Predicate) setPredicate are invoked.


FilterListIterator

public FilterListIterator(ListIterator iterator, Predicate predicate)

Constructs a new FilterListIterator.

Parameters:
iterator - the iterator to use
predicate - the predicate to use

FilterListIterator

public FilterListIterator(ListIterator iterator)

Constructs a new FilterListIterator that will not function until setPredicate(Predicate) setPredicate is invoked.

Parameters:
iterator - the iterator to use

FilterListIterator

public FilterListIterator(Predicate predicate)

Constructs a new FilterListIterator that will not function until ProxyListIterator.setListIterator(ListIterator) is invoked.

Parameters:
predicate - the predicate to use.

Method Details

add

public void add(Object o)

Not supported.

Parameters:
o

getListIterator

public ListIterator getListIterator()

Gets the iterator this iterator is using.

Returns:
the iterator.

getPredicate

public Predicate getPredicate()

Gets the predicate this iterator is using.

Returns:
the predicate.

hasNext

public boolean hasNext()


hasPrevious

public boolean hasPrevious()


next

public Object next()


nextIndex

public int nextIndex()


previous

public Object previous()


previousIndex

public int previousIndex()


remove

public void remove()

Not supported.


set

public void set(Object o)

Not supported.

Parameters:
o

setListIterator

public void setListIterator(ListIterator iterator)

Sets the iterator for this iterator to use. If iteration has started, this effectively resets the iterator.

Parameters:
iterator - the iterator to use

setPredicate

public void setPredicate(Predicate predicate)

Sets the predicate this the iterator to use.

Parameters:
predicate - the transformer to use