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

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

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

import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;

import net.sf.javagimmicks.transform.Transforming;
import net.sf.javagimmicks.util.Function;

class TransformingCollection
	extends AbstractCollection
	implements Transforming
{
   protected final Collection _internalCollection;
   private final Function _transformer;
   
   /**
    * @deprecated Use TranformerUtils.decorate() instead
    */
   @Deprecated
   public TransformingCollection(Collection collection, Function transformer)
   {
      _internalCollection = collection;
      _transformer = transformer;
   }
   
   public Function getTransformerFunction()
	{
		return _transformer;
	}

   @Override
   public Iterator iterator()
   {
      return TransformerUtils.decorate(_internalCollection.iterator(), getTransformerFunction());
   }

   @Override
   public int size()
   {
      return _internalCollection.size();
   }

   @Override
   public void clear()
   {
      _internalCollection.clear();
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy