Type safety is a goodness.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1902 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2006-09-12 23:24:03 +00:00
parent bb500f938e
commit 420b86f2db
+3 -8
View File
@@ -24,7 +24,7 @@ package com.samskivert.util;
* A simple object that holds a reference to two ints. * A simple object that holds a reference to two ints.
*/ */
public class IntTuple public class IntTuple
implements Comparable implements Comparable<IntTuple>
{ {
/** The left int. */ /** The left int. */
public int left; public int left;
@@ -53,14 +53,9 @@ public class IntTuple
} }
// documentation inherited from interface // documentation inherited from interface
public int compareTo (Object o) public int compareTo (IntTuple ot)
{ {
if (o instanceof IntTuple) { return (left == ot.left) ? (right - ot.right) : (left - ot.left);
IntTuple ot = (IntTuple)o;
return (left == ot.left) ? (right - ot.right) : (left - ot.left);
} else {
return hashCode() - o.hashCode();
}
} }
/** /**