Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jdaemon.util.iterator
Class FilterIterator  view FilterIterator download FilterIterator.java

java.lang.Object
  extended byorg.jdaemon.util.iterator.FilterIterator
All Implemented Interfaces:
java.util.Iterator
Direct Known Subclasses:
ExcludeIterator

public abstract class FilterIterator
extends java.lang.Object
implements java.util.Iterator

Iterator that returns subset of values from some other enumeration that match some predicate function (the 'filter')

Version:

Field Summary
private  java.util.Iterator enum
          Superset enumeration
private  java.lang.Object next
          Lookahead object
 
Constructor Summary
FilterIterator(java.util.Iterator superset)
          Creates new FilterIterator
 
Method Summary
abstract  boolean filter(java.lang.Object obj)
          This method should return true for any element we wish to include in the subset
 boolean hasNext()
          True if more elements exist in filtered subset
private  void moveNext()
           
 java.lang.Object next()
          Get next element in filtered subset
 void remove()
          Remove from the underlying collection the last element returned by next (optional operation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enum

private java.util.Iterator enum
Superset enumeration


next

private java.lang.Object next
Lookahead object

Constructor Detail

FilterIterator

public FilterIterator(java.util.Iterator superset)
Creates new FilterIterator

Method Detail

moveNext

private void moveNext()

hasNext

public boolean hasNext()
True if more elements exist in filtered subset

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Get next element in filtered subset

Specified by:
next in interface java.util.Iterator

remove

public void remove()
Description copied from interface: java.util.Iterator
Remove from the underlying collection the last element returned by next (optional operation). This method can be called only once after each call to next(). It does not affect what will be returned by subsequent calls to next.

Specified by:
remove in interface java.util.Iterator

filter

public abstract boolean filter(java.lang.Object obj)
This method should return true for any element we wish to include in the subset