src/share/classes/java/lang/Float.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

*** 119,128 **** --- 119,135 ---- * @since 1.5 */ public static final int SIZE = 32; /** + * The number of bytes used to represent a {@code float} value. + * + * @since 1.8 + */ + public static final int BYTES = SIZE / Byte.SIZE; + + /** * The {@code Class} instance representing the primitive type * {@code float}. * * @since JDK1.1 */
*** 636,645 **** --- 643,664 ---- public int hashCode() { return floatToIntBits(value); } /** + * Returns a hash code for a {@code float} value; compatible with + * {@code Float.hashCode()}. + * + * @since 1.8 + * + * @return a hash code value for a {@code float} value. + */ + public static int hashCode(float value) { + return floatToIntBits(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 Float} object that * represents a {@code float} with the same value as the