Top Description Fields Constructors Methods
org.dom4j.tree

public abstract Class FilterIterator<T>

extends Object
implements Iterator<T>
Class Inheritance
All Implemented Interfaces
java.util.Iterator
Known Direct Subclasses
org.dom4j.tree.ElementIterator, org.dom4j.tree.ElementNameIterator, org.dom4j.tree.ElementQNameIterator
Imports
java.util.Iterator, .NoSuchElementException

Deprecated

THIS CLASS WILL BE REMOVED IN dom4j-1.6 !!

FilterIterator is an abstract base class which is useful for implementors of Iteratorwhich filter an existing iterator.

Author
James Strachan
Version
$Revision: 1.10 $

Field Summary

Modifier and TypeField and Description
private boolean
private T
protected Iterator<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected T
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
protected abstract boolean

Returns:

true if the given element matches the filter and should be appear in the iteration
matches
(T
DOCUMENT ME!
element
)

Filter method to perform some matching on the given element.

public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
remove()

Overrides default java.util.Iterator.remove.

Always throws UnsupportedOperationException as this class does look-ahead with its internal iterator.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

firstback to summary
private boolean first
nextback to summary
private T next
proxyback to summary
protected Iterator<T> proxy

Constructor Detail

FilterIteratorback to summary
public FilterIterator(Iterator<T> proxy)

Method Detail

findNextback to summary
protected T findNext()
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

matchesback to summary
protected abstract boolean matches(T element)

Filter method to perform some matching on the given element.

Parameters
element:T

DOCUMENT ME!

Returns:boolean

true if the given element matches the filter and should be appear in the iteration

nextback to summary
public T next() throws NoSuchElementException

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:T

the next element in the iteration

Exceptions
NoSuchElementException:
if the iteration has no more elements
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Always throws UnsupportedOperationException as this class does look-ahead with its internal iterator.

Exceptions
UnsupportedOperationException:
always