Class Iterators


  • public final class Iterators
    extends java.lang.Object
    A collection of Iterator and Enumeration utilities.
    Version:
    $Revision$
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Iterator EMPTY_ITERATOR
      An empty Iterator
    • Constructor Summary

      Constructors 
      Constructor Description
      Iterators()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Iterator forEnumeration​(java.util.Enumeration enumeration)
      Return an Iterator wrapper for the given Enumeration
      static java.util.Iterator makeImmutable​(java.util.Iterator iter)
      Make an Iterator immutable
      static java.util.Enumeration makeSynchronized​(java.util.Enumeration enumeration)
      Returns a synchronized version of the given Enumeration.
      static java.util.Iterator makeSynchronized​(java.util.Iterator iter)
      Returns a synchronized version of the given Iterator.
      static java.util.Enumeration toEnumeration​(java.util.Iterator iter)
      Return an Enumeration for the given Iterator.
      static java.lang.String toString​(java.util.Iterator iter)
      Return a comma delimited string representation of all of the elements in the given Iterator.
      static java.lang.String toString​(java.util.Iterator iter, java.lang.String delim)
      Return a delimited string representation of all of the elements in the given Iterator.
      static java.util.Iterator union​(java.util.Iterator[] iters)
      Returns an Iterator containing the union of all of the elements in the given iterator array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMPTY_ITERATOR

        public static final java.util.Iterator EMPTY_ITERATOR
        An empty Iterator
    • Constructor Detail

      • Iterators

        public Iterators()
    • Method Detail

      • forEnumeration

        public static java.util.Iterator forEnumeration​(java.util.Enumeration enumeration)
        Return an Iterator wrapper for the given Enumeration
        Parameters:
        enumeration - Enumeration to wrap
        Returns:
        Enumeration wrapped as an Iterator
      • toEnumeration

        public static java.util.Enumeration toEnumeration​(java.util.Iterator iter)
        Return an Enumeration for the given Iterator.
        Parameters:
        iter - Iterator to wrap.
        Returns:
        Enumeration wrapper.
      • makeImmutable

        public static java.util.Iterator makeImmutable​(java.util.Iterator iter)
        Make an Iterator immutable
        Parameters:
        iter - Iterator to make immutable
        Returns:
        Imutable iterator
      • makeSynchronized

        public static java.util.Iterator makeSynchronized​(java.util.Iterator iter)
        Returns a synchronized version of the given Iterator.
        Parameters:
        iter - Iterator to synchronize.
        Returns:
        Synchronized Iterator.
      • makeSynchronized

        public static java.util.Enumeration makeSynchronized​(java.util.Enumeration enumeration)
        Returns a synchronized version of the given Enumeration.
        Parameters:
        enumeration - Enumeration to synchronize.
        Returns:
        Synchronized Enumeration.
      • union

        public static java.util.Iterator union​(java.util.Iterator[] iters)
        Returns an Iterator containing the union of all of the elements in the given iterator array.
        Parameters:
        iters - Array of iterators.
        Returns:
        Iterator containing the union.
      • toString

        public static java.lang.String toString​(java.util.Iterator iter,
                                                java.lang.String delim)
        Return a delimited string representation of all of the elements in the given Iterator.
        Parameters:
        iter - Iterator to convert to string.
        delim - Elemement delimiter.
        Returns:
        Delimited string value.
      • toString

        public static java.lang.String toString​(java.util.Iterator iter)
        Return a comma delimited string representation of all of the elements in the given Iterator.
        Parameters:
        iter - Iterator to convert to string.
        Returns:
        Delimited string value.