public class QualityComparator extends Object implements Comparator<AcceptLanguageEntry>
AcceptLanguageEntry
objects by their quality value.
The highest value will be the first in the list.Modifier and Type | Method and Description |
---|---|
int |
compare(AcceptLanguageEntry o1,
AcceptLanguageEntry o2)
Returns -1 if
o1.getQuality() is less than o2.getQuality() , 0 is they are
equal and 1 if o1.getQuality() is greater than o2.getQuality() . |
static QualityComparator |
getInstance() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static QualityComparator getInstance()
public int compare(AcceptLanguageEntry o1, AcceptLanguageEntry o2)
o1.getQuality()
is less than o2.getQuality()
, 0 is they are
equal and 1 if o1.getQuality()
is greater than o2.getQuality()
. (Note that lists
sorted with this method will the contains the highest quality values at first.)compare
in interface Comparator<AcceptLanguageEntry>
Comparator.compare(java.lang.Object, java.lang.Object)