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

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

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

import java.util.Comparator;

import net.sf.javagimmicks.util.Function;

class TransformingComparator implements Comparator
{  
   protected final Comparator _internalComparator;
   private final Function _transformer;
   
   /**
    * @deprecated Use TranformerUtils.decorate() instead
    */
   @Deprecated
   public TransformingComparator(Comparator comparator, Function transformer)
   {
      _internalComparator = comparator;
      _transformer = transformer;
   }

   public int compare(T o1, T o2)
   {
      return _internalComparator.compare(_transformer.apply(o1), _transformer.apply(o2));
   }
   
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy