JAPI pointed out that this method (@since 1.5) wasn't implemented so I wrote it.
JAPI also said that Boolean.compareTo(Object) is missing, but I don't believe that's actually in the JDK library. It's not in the specs and a testcase I wrote using it doesn't compile. JAPI problem? 2005-11-07 Anthony Balkissoon <[EMAIL PROTECTED]> * java/lang/Boolean.java: (compareTo(Boolean)): New API method. --Tony
Index: java/lang/Boolean.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/lang/Boolean.java,v retrieving revision 1.23 diff -u -r1.23 Boolean.java --- java/lang/Boolean.java 17 Sep 2005 21:58:41 -0000 1.23 +++ java/lang/Boolean.java 7 Nov 2005 16:59:47 -0000 @@ -233,4 +233,24 @@ { return "true".equalsIgnoreCase(b) ? true : false; } + + /** + * Compares this Boolean to another. + * @param b the Boolean to compare this Boolean to + * @return 0 if both Booleans represent the same value, a positive number + * if this Boolean represents true and b represents false, or a negative + * number otherwise. + * @since 1.5 + */ + public int compareTo (Boolean b) + { + if (b == null) + throw new NullPointerException("argument passed to compareTo(Boolean) cannot be null"); + + if (this.value == b.value) + return 0; + if (this.value == true) + return 1; + return -1; + } }
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches