Class TransformIterator

  • All Implemented Interfaces:
    java.util.Iterator

    @Deprecated(since="2021-04-30")
    public class TransformIterator
    extends java.lang.Object
    implements java.util.Iterator
    Deprecated.
    Commons Collections 3 is in maintenance mode. Commons Collections 4 should be used instead.
    Decorates an iterator such that each element returned is transformed.
    Since:
    Commons Collections 1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      TransformIterator()
      Deprecated.
      Constructs a new TransformIterator that will not function until the setIterator method is invoked.
      TransformIterator​(java.util.Iterator iterator)
      Deprecated.
      Constructs a new TransformIterator that won't transform elements from the given iterator.
      TransformIterator​(java.util.Iterator iterator, Transformer transformer)
      Deprecated.
      Constructs a new TransformIterator that will use the given iterator and transformer.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.util.Iterator getIterator()
      Deprecated.
      Gets the iterator this iterator is using.
      Transformer getTransformer()
      Deprecated.
      Gets the transformer this iterator is using.
      boolean hasNext()
      Deprecated.
       
      java.lang.Object next()
      Deprecated.
      Gets the next object from the iteration, transforming it using the current transformer.
      void remove()
      Deprecated.
       
      void setIterator​(java.util.Iterator iterator)
      Deprecated.
      Sets the iterator for this iterator to use.
      void setTransformer​(Transformer transformer)
      Deprecated.
      Sets the transformer this the iterator to use.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Constructor Detail

      • TransformIterator

        public TransformIterator()
        Deprecated.
        Constructs a new TransformIterator that will not function until the setIterator method is invoked.
      • TransformIterator

        public TransformIterator​(java.util.Iterator iterator)
        Deprecated.
        Constructs a new TransformIterator that won't transform elements from the given iterator.
        Parameters:
        iterator - the iterator to use
      • TransformIterator

        public TransformIterator​(java.util.Iterator iterator,
                                 Transformer transformer)
        Deprecated.
        Constructs a new TransformIterator that will use the given iterator and transformer. If the given transformer is null, then objects will not be transformed.
        Parameters:
        iterator - the iterator to use
        transformer - the transformer to use
    • Method Detail

      • hasNext

        public boolean hasNext()
        Deprecated.
        Specified by:
        hasNext in interface java.util.Iterator
      • next

        public java.lang.Object next()
        Deprecated.
        Gets the next object from the iteration, transforming it using the current transformer. If the transformer is null, no transformation occurs and the object from the iterator is returned directly.
        Specified by:
        next in interface java.util.Iterator
        Returns:
        the next object
        Throws:
        java.util.NoSuchElementException - if there are no more elements
      • remove

        public void remove()
        Deprecated.
        Specified by:
        remove in interface java.util.Iterator
      • getIterator

        public java.util.Iterator getIterator()
        Deprecated.
        Gets the iterator this iterator is using.
        Returns:
        the iterator.
      • setIterator

        public void setIterator​(java.util.Iterator iterator)
        Deprecated.
        Sets the iterator for this iterator to use. If iteration has started, this effectively resets the iterator.
        Parameters:
        iterator - the iterator to use
      • getTransformer

        public Transformer getTransformer()
        Deprecated.
        Gets the transformer this iterator is using.
        Returns:
        the transformer.
      • setTransformer

        public void setTransformer​(Transformer transformer)
        Deprecated.
        Sets the transformer this the iterator to use. A null transformer is a no-op transformer.
        Parameters:
        transformer - the transformer to use