src/share/classes/java/lang/Character.java

Print this page
rev 4568 : 7088952: Add "BYTES" constant to primitive wrapper classes
7088913: Add compatible static hashCode(primitive) to primitive wrapper classes
Reviewed-by: smarks

*** 4407,4416 **** --- 4407,4428 ---- public int hashCode() { return (int)value; } /** + * Returns a hash code for a {@code char} value; compatible with + * {@code Character.hashCode()}. + * + * @since 1.8 + * + * @return a hash code value for a {@code char} value. + */ + public static int hashCode(char value) { + return (int)value; + } + + /** * Compares this object against the specified object. * The result is {@code true} if and only if the argument is not * {@code null} and is a {@code Character} object that * represents the same {@code char} value as this object. *
*** 6972,6981 **** --- 6984,7001 ---- * @since 1.5 */ public static final int SIZE = 16; /** + * The number of bytes used to represent a {@code char} value in unsigned + * binary form. + * + * @since 1.8 + */ + public static final int BYTES = SIZE / Byte.SIZE; + + /** * Returns the value obtained by reversing the order of the bytes in the * specified <tt>char</tt> value. * * @return the value obtained by reversing (or, equivalently, swapping) * the bytes in the specified <tt>char</tt> value.