diff --git a/src/java/com/samskivert/util/Comparators.java b/src/java/com/samskivert/util/Comparators.java index 017fb21c..1c35d225 100644 --- a/src/java/com/samskivert/util/Comparators.java +++ b/src/java/com/samskivert/util/Comparators.java @@ -22,6 +22,8 @@ package com.samskivert.util; import java.util.Comparator; +import com.samskivert.annotation.ReplacedBy; + /** * A repository for standard comparators. */ @@ -30,6 +32,7 @@ public class Comparators /** * A comparator that compares the toString() value of all objects case insensitively. */ + @ReplacedBy("com.google.common.collect.Ordering.from(String.CASE_INSENSITIVE_ORDER).onResultOf(Functions.toStringFunction()") public static final Comparator LEXICAL_CASE_INSENSITIVE = new Comparator() { public int compare (Object o1, Object o2) { @@ -49,6 +52,7 @@ public class Comparators /** * A comparator that compares {@link Comparable} instances. */ + @ReplacedBy("com.google.common.collect.Ordering.natural().nullsLast()") public static final Comparator> COMPARABLE = new Comparator>() { public int compare (Comparable o1, Comparable o2) @@ -74,6 +78,7 @@ public class Comparators */ // we can't do the "more correct" > here as that causes other // code to freak out; I don't entirely understand why + @ReplacedBy("com.google.common.collect.Ordering.natural().nullsLast()") public static final > Comparator comparable () { @SuppressWarnings("unchecked") Comparator comp = (Comparator)COMPARABLE; @@ -84,6 +89,7 @@ public class Comparators * Compares two bytes, returning 1, 0, or -1. * TODO: remove when Java finally has this method in Byte. */ + @ReplacedBy("com.google.common.primitives.SignedBytes.compare()") public static int compare (byte value1, byte value2) { return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1)); @@ -93,6 +99,7 @@ public class Comparators * Compares two chars, returning 1, 0, or -1. * TODO: remove when Java finally has this method in Character. */ + @ReplacedBy("com.google.common.primitives.Chars.compare()") public static int compare (char value1, char value2) { return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1)); @@ -102,6 +109,7 @@ public class Comparators * Compares two shorts, returning 1, 0, or -1. * TODO: remove when Java finally has this method in Character. */ + @ReplacedBy("com.google.common.primitives.Shorts.compare()") public static int compare (short value1, short value2) { return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1)); @@ -111,6 +119,7 @@ public class Comparators * Compares two integers in an overflow safe manner, returning 1, 0, or -1. * TODO: remove when Java finally has this method in Integer. */ + @ReplacedBy("com.google.common.primitives.Ints.compare()") public static int compare (int value1, int value2) { return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1)); @@ -120,6 +129,7 @@ public class Comparators * Compares two longs in an overflow safe manner, returning 1, 0, or -1. * TODO: remove when Java finally has this method in Long. */ + @ReplacedBy("com.google.common.primitives.Longs.compare()") public static int compare (long value1, long value2) { return (value1 < value2 ? -1 : (value1 == value2 ? 0 : 1)); @@ -133,6 +143,7 @@ public class Comparators * * If all values in the array are zero, zero is returned. */ + @ReplacedBy("com.google.common.collect.ComparisonChain") public static int combine (int ... values) { for (int value : values) { @@ -151,6 +162,7 @@ public class Comparators * Compares two booleans, returning 1, 0, or -1. * TODO: remove when Java finally has this method in Boolean. */ + @ReplacedBy("com.google.common.primitives.Booleans.compare()") public static int compare (boolean value1, boolean value2) { return (value1 == value2) ? 0 : (value1 ? 1 : -1);