Package diva.util
Class IteratorUtilities
- java.lang.Object
-
- diva.util.IteratorUtilities
-
public class IteratorUtilities extends java.lang.Object
A collection of utilities dealing with iterators.- Version:
- $Id$
- Author:
- John Reekie, Michael Shilman
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 prefix, java.lang.String desc, java.util.Iterator i)
Print every element of an iterator to stdout.static void
printElements(java.lang.String desc, java.util.Iterator i)
Print every element of an iterator to stdout.
-
-
-
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.
-
-