Class PriorityOrdering<P extends Comparable<? super P>,T>
java.lang.Object
com.google.common.collect.Ordering<T>
com.github.ferstl.maven.pomenforcers.priority.PriorityOrdering<P,T>
- Type Parameters:
P- Type of the priority collection.T- Type of the values to be compared.
- All Implemented Interfaces:
Comparator<T>
public class PriorityOrdering<P extends Comparable<? super P>,T>
extends com.google.common.collect.Ordering<T>
Comparator that makes comparisons based on a priority collection. Objects that match an item in
the priority collection will be considered smaller than objects that don't match any item in the
priority collection. If both compared objects match different items in the priority collection,
the object that matches the item closer to the
beginningof the collection (as returned by the collection's iterator) will be considered smaller. Thus, it is recommended to use
Lists or LinkedHashSets to define the priority collection.-
Constructor Summary
ConstructorsConstructorDescriptionPriorityOrdering(Collection<P> priorityCollection, Function<T,P> transformer)PriorityOrdering(Collection<P> prioritizedItems, Function<T,P> transformer, com.google.common.base.Equivalence<? super P> priorityMatcher) -
Method Summary
Methods inherited from class com.google.common.collect.Ordering
allEqual, arbitrary, binarySearch, compound, compound, explicit, explicit, from, from, greatestOf, greatestOf, immutableSortedCopy, isOrdered, isStrictlyOrdered, leastOf, leastOf, lexicographical, max, max, max, max, min, min, min, min, natural, nullsFirst, nullsLast, onResultOf, reverse, sortedCopy, usingToStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
PriorityOrdering
-
PriorityOrdering
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<P extends Comparable<? super P>>- Specified by:
comparein classcom.google.common.collect.Ordering<T>
-