gshute.util
Class Iterators

java.lang.Object
  |
  +--gshute.util.Iterators

public class Iterators
extends java.lang.Object

Class Iterators is a factory class that provides filters for accepting classes and methods based on various criteria. In addition, this class provides static methods for directly testing whether or not classes methods meet various criteria.


Inner Class Summary
static class Iterators.ArrayIterator
          Class gshute.util.Iterators.ArrayIterator implements the ListIterator interface for arrays.
static class Iterators.ConcatenatedIterator
          Class gshute.util.Iterators.ConcatenatedIterator implements the ListIterator interface for arrays.
 
Field Summary
protected static java.util.Iterator emptyIterator
          emptyIterator is the singleton empty Iterator.
 
Method Summary
static java.util.Iterator concat(java.util.Iterator iter1, java.util.Iterator iter2)
          Iterators.concat(iter1, iter2) returns an iterator whose iteration sequence is the concatenation of the iteration sequences of iter1 and iter2.
static java.util.Iterator getArrayIterator(java.lang.Object[] ar)
          Iterators.getArrayIterator(Object[] ar) returns an iterator for the entries of ar.
static java.util.Iterator getEmptyIterator()
          Iterators.getEmptyIterator() returns an empty iterator.
static java.util.Enumeration toEnumeration(java.util.Iterator iter)
          Iterators.toEnumeration(iter) returns iter wrapped as an enumeration.
static java.util.Iterator toIterator(java.util.Enumeration enum)
          Iterators.toIterator(enum) returns enum wrapped as an iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

emptyIterator

protected static java.util.Iterator emptyIterator
emptyIterator is the singleton empty Iterator.
Method Detail

getEmptyIterator

public static java.util.Iterator getEmptyIterator()
Iterators.getEmptyIterator() returns an empty iterator.

toEnumeration

public static java.util.Enumeration toEnumeration(java.util.Iterator iter)
Iterators.toEnumeration(iter) returns iter wrapped as an enumeration.

toIterator

public static java.util.Iterator toIterator(java.util.Enumeration enum)
Iterators.toIterator(enum) returns enum wrapped as an iterator. The iterator does not implement the remove() method. It throws an UnsupportedOperationException when remove() is invoked.

getArrayIterator

public static java.util.Iterator getArrayIterator(java.lang.Object[] ar)
Iterators.getArrayIterator(Object[] ar) returns an iterator for the entries of ar. If ar is null then an empty iterator is returned.

concat

public static java.util.Iterator concat(java.util.Iterator iter1,
                                        java.util.Iterator iter2)
Iterators.concat(iter1, iter2) returns an iterator whose iteration sequence is the concatenation of the iteration sequences of iter1 and iter2. Both iter1 and iter2 must be non-null.