diva.util
Class IteratorUtilities

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

public class IteratorUtilities
extends Object

A collection of utilities dealing with iterators.

Version:
$Revision: 1.5 $
Author:
John Reekie (johnr@eecs.berkeley.edu), Michael Shilman (michaels@eecs.berkeley.edu)

Method Summary
static Object firstMatch(Iterator i, Filter f)
          Return the first element in an iterator that matches the given filter, or null if there isn't one.
static Object firstNotMatch(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(String desc, Iterator i)
          Print every element of an iterator to stdout.
static void printElements(String prefix, String desc, 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 Object firstMatch(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 Object firstNotMatch(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(String desc,
                                 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(String prefix,
                                 String desc,
                                 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.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.