net.sf.javagimmicks.collections8.transformer.TransformingComparator 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.Comparator;
import java.util.function.Function;
import net.sf.javagimmicks.transform8.Transforming;
class TransformingComparator implements Comparator, Transforming
{
protected final Comparator super F> _internalComparator;
private final Function _transformer;
TransformingComparator(Comparator super F> comparator, Function transformer)
{
_internalComparator = comparator;
_transformer = transformer;
}
public int compare(T o1, T o2)
{
return _internalComparator.compare(_transformer.apply(o1), _transformer.apply(o2));
}
@Override
public Function getTransformerFunction()
{
return _transformer;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy