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

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

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

import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;
import java.util.Spliterator;
import java.util.function.Function;

import net.sf.javagimmicks.transform8.Transforming;

class TransformingCollection
	extends AbstractCollection
	implements Transforming
{
   protected final Collection _internalCollection;
   private final Function _transformer;
   
   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 Spliterator spliterator()
   {
      return TransformerUtils.decorate(_internalCollection.spliterator(), getTransformerFunction());
   }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy