包装类:->Byte
取值范围:最小值 MIN_VALUE = -128 ~ 最大值 MAX_VALUE = 127
//返回对象的值Value
@Override
public int hashCode() {
return Byte.hashCode(value);
}
/**
* Returns a hash code for a {@code byte} value; compatible with
* {@code Byte.hashCode()}.
*
* @param value the value to hash
* @return a hash code value for a {@code byte} value.
* @since 1.8
*/
public static int hashCode(byte value) {
return (int)value;
}
包装类->Character
取值范围:最小值 MIN_VALUE = '\u0000' ~ 最大值 MAX_VALUE = '\uFFFF'
//返回字符整形数字
@Override
public int hashCode() {
return Character.hashCode(value);
}
/**
* Returns a hash code for a {@code char} value; compatible with
* {@code Character.hashCode()}.
*
* @since 1.8
*
* @param value The {@code char} for which to return a hash code.
* @return a hash code value for a {@code char} value.
*/
public static int hashCode(char value) {
return (int)value;
}
包装类->Short
取值范围:最小值 MIN_VALUE = -32768 () ~ 最大值 MAX_VALUE = 32767()
//返回一个整形
@Override
public int hashCode() {
return Short.hashCode(value);
}
/**
* Returns a hash code for a {@code short} value; compatible with
* {@code Short.hashCode()}.
*
* @param value the value to hash
* @return a hash code value for a {@code short} value.
* @since 1.8
*/
public static int hashCode(short value) {
return (int)value;
}
包装类->Integer
取值范围:最小值 MIN_VALUE = 0x80000000() ~ 最大值 MAX_VALUE = 0x7fffffff()
@Override
public int hashCode() {
return Integer.hashCode(value);
}
/**
* Returns a hash code for a {@code int} value; compatible with
* {@code Integer.hashCode()}.
*
* @param value the value to hash
* @since 1.8
*
* @return a hash code value for a {@code int} value.
*/
public static int hashCode(int value) {
return value;
}
包装类->Long
取值范围:最小值 MIN_VALUE = 0x8000000000000000L() ~ 最大值 MAX_VALUE = 0x7fffffffffffffffL()
@Override
public int hashCode() {
return Long.hashCode(value);
}
/**
* Returns a hash code for a {@code long} value; compatible with
* {@code Long.hashCode()}.
*
* @param value the value to hash
* @return a hash code value for a {@code long} value.
* @since 1.8
*/
public static int hashCode(long value) {
return (int)(value ^ (value >>> 32));
}