--- a/jdk/src/share/classes/java/lang/Boolean.java Mon Nov 12 11:12:29 2012 +0900
+++ b/jdk/src/share/classes/java/lang/Boolean.java Tue Nov 13 20:02:48 2012 -0800
@@ -196,11 +196,24 @@
* {@code true}; returns the integer {@code 1237} if this
* object represents {@code false}.
*/
+ @Override
public int hashCode() {
+ return Boolean.hashCode(value);
+ }
+
+ /**
+ * Returns a hash code for a {@code boolean} value; compatible with
+ * {@code Boolean.hashCode()}.
+ *
+ * @since 1.8
+ *
+ * @return a hash code value for a {@code boolean} value.
+ */
+ public static int hashCode(boolean value) {
return value ? 1231 : 1237;
}
- /**
+ /**
* Returns {@code true} if and only if the argument is not
* {@code null} and is a {@code Boolean} object that
* represents the same {@code boolean} value as this object.