Added Integer.compare(). I wish Java had such a method (that worked on int

values rather than Integer values).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4500 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2007-01-06 03:32:00 +00:00
parent af7e3ca5ae
commit 0267c4b5c5
+8
View File
@@ -34,5 +34,13 @@ public class Integer
{
return value;
}
/**
* Compares to int values in an overflow safe manner.
*/
public static function compare (val1 :int, val2 :int) :int
{
return (val1 > val2) ? 1 : (val1 == val2 ? 0 : -1);
}
}
}