All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.javagimmicks.collections.transformer.TransformingIterator Maven / Gradle / Ivy

There is a newer version: 0.99-alpha1
Show newest version
package net.sf.javagimmicks.collections.transformer;

import java.util.Iterator;

import net.sf.javagimmicks.transform.Transformer;
import net.sf.javagimmicks.transform.Transforming;

class TransformingIterator implements Iterator, Transforming
{
   protected final Iterator _internalIterator;
   private final Transformer _transformer;

   /**
    * @deprecated Use TranformerUtils.decorate() instead
    */
   @Deprecated
   public TransformingIterator(Iterator iterator, Transformer transformer)
   {
      _internalIterator = iterator;
      _transformer = transformer;
   }
   
   public Transformer getTransformer()
   {
      return _transformer;
   }

   public boolean hasNext()
   {
      return _internalIterator.hasNext();
   }

   public T next()
   {
      return transform(_internalIterator.next());
   }

   public void remove()
   {
      _internalIterator.remove();
   }
   
   protected T transform(F element)
   {
       return getTransformer().transform(element);
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy