diva.util
Class IteratorUtilities

java.lang.Object
  extended bydiva.util.IteratorUtilities

public class IteratorUtilities
extends java.lang.Object

A collection of utilities dealing with iterators.

Version:
$Id: IteratorUtilities.java,v 1.7 2004/04/13 18:49:06 cxh Exp $
Author:
John Reekie, Michael Shilman

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
 

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.