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

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

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

import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Set;
import java.util.Spliterator;
import java.util.function.Function;

import net.sf.javagimmicks.transform8.Transforming;

class TransformingSet
   extends AbstractSet
   implements Transforming
{
   protected final Set _internalSet;
   private final Function _transformer;
   
   TransformingSet(Set set, Function transformer)
   {
      _internalSet = set;
      _transformer = transformer;
   }

   public Function getTransformerFunction()
   {
      return _transformer;
   }

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

   @Override
   public Spliterator spliterator()
   {
      return TransformerUtils.decorate(_internalSet.spliterator(), getTransformerFunction());
   }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy