Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle WebCenter Portal
11g Release 1 (11.1.1.7.0)
E15995-06


oracle.webcenter.search.util
Class ConditionalIterator<T>

java.lang.Object
  extended by oracle.webcenter.search.util.ConditionalIterator<T>

All Implemented Interfaces:
java.util.Iterator<T>

public abstract class ConditionalIterator<T>
extends java.lang.Object
implements java.util.Iterator<T>

A generic utility decorator abstract base class of Iterator that allows subclasses to decide when an element can be included in the resulting Iterator.

Since:
11.1.1.0.0 Beta 2

Constructor Summary
ConditionalIterator(java.util.Iterator<T> source)
          Constructs a ConditionalIterator with a source Iterator of type T.

 

Method Summary
 boolean hasNext()
          Whether there are more elements to be fetched from this Iterator.
protected abstract  boolean isAllowed(T element)
          Subclasses implement this method to determine if an element is allowed to be returned.
 T next()
          Fetches the next element in the Iterator that matches the condition implemented by subclasses' isAllowed method.
 void remove()
          Removes the currently selected element in the Iterator.

 

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

 

Constructor Detail

ConditionalIterator

public ConditionalIterator(java.util.Iterator<T> source)
Constructs a ConditionalIterator with a source Iterator of type T.
Parameters:
source - an Iterator of type T to test conditions on

Method Detail

hasNext

public boolean hasNext()
Whether there are more elements to be fetched from this Iterator. This method calls the abstract method of isAllowed to test elements for availability from the Iterator.
Specified by:
hasNext in interface java.util.Iterator<T>
Returns:
true if there are more elements to be fetched.

remove

public void remove()
Removes the currently selected element in the Iterator.
Specified by:
remove in interface java.util.Iterator<T>

next

public T next()
Fetches the next element in the Iterator that matches the condition implemented by subclasses' isAllowed method.
Specified by:
next in interface java.util.Iterator<T>
Returns:
the next element of type T that matches the condition tested for in the isAllowed method.

isAllowed

protected abstract boolean isAllowed(T element)
Subclasses implement this method to determine if an element is allowed to be returned.
Parameters:
element - Iterator element being tested for allowal
Returns:
true if the resulting iterator is to allow passed in element to be included

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle WebCenter Portal
11g Release 1 (11.1.1.7.0)
E15995-06


Copyright © 2009, 2013, Oracle and/or its affiliates. All rights reserved.