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:
@@ -34,5 +34,13 @@ public class Integer
|
|||||||
{
|
{
|
||||||
return value;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user