net.sf.javagimmicks.collections8.transformer.TransformingCollection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gimmicks Show documentation
Show all versions of gimmicks Show documentation
Utility classes, APIs and tools for Java
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