diva.util
Class IteratorUtilities

java.lang.Object
  extended by diva.util.IteratorUtilities

public class IteratorUtilities
extends java.lang.Object

A collection of utilities dealing with iterators.

Version:
$Id: IteratorUtilities.java 38798 2005-07-08 20:00:01Z cxh $
Author:
John Reekie, Michael Shilman

Constructor Summary
private IteratorUtilities()
          You can't instantiate this class.
 
Method Summary
static java.lang.Object firstMatch(java.util.Iterator i, Filter f)
          Return the first element in an iterator that matches the given filter, or null if there isn't one.
static java.lang.Object firstNotMatch(java.util.Iterator i, Filter f)
          Return the first element in an iterator that doesn't match the given filter, or null if there isn't one.
static void printElements(java.lang.String desc, java.util.Iterator i)
          Print every element of an iterator to stdout.
static void printElements(java.lang.String prefix, java.lang.String desc, java.util.Iterator i)
          Print every element of an iterator to stdout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IteratorUtilities

private IteratorUtilities()
You can't instantiate this class.

Method Detail

firstMatch

public static java.lang.Object firstMatch(java.util.Iterator i,
                                          Filter f)
Return the first element in an iterator that matches the given filter, or null if there isn't one.


firstNotMatch

public static java.lang.Object firstNotMatch(java.util.Iterator i,
                                             Filter f)
Return the first element in an iterator that doesn't match the given filter, or null if there isn't one.


printElements

public static void printElements(java.lang.String desc,
                                 java.util.Iterator i)
Print every element of an iterator to stdout. The string argument is printed first, and then each element is printed on a new line but indented.


printElements

public static void printElements(java.lang.String prefix,
                                 java.lang.String desc,
                                 java.util.Iterator i)
Print every element of an iterator to stdout. The string argument is printed first with the prefix argument leading it; then each element is printed on a new line with additional indentation.