src/share/classes/java/util/OptionalDouble.java
Print this page
rev 7596 : 8015317: Optional.filter, map, and flatMap
Reviewed-by:
Contributed-by: brian.goetz@oracle.com, henry.jen@oracle.com
*** 184,197 ****
throw exceptionSupplier.get();
}
}
/**
! * Indicates whether some other object is "equal to" this Optional. The
* other object is considered equal if:
* <ul>
! * <li>it is also an {@code OptionalInt} and;
* <li>both instances have no value present or;
* <li>the present values are "equal to" each other via {@code Double.compare() == 0}.
* </ul>
*
* @param obj an object to be tested for equality
--- 184,197 ----
throw exceptionSupplier.get();
}
}
/**
! * Indicates whether some other object is "equal to" this OptionalDouble. The
* other object is considered equal if:
* <ul>
! * <li>it is also an {@code OptionalDouble} and;
* <li>both instances have no value present or;
* <li>the present values are "equal to" each other via {@code Double.compare() == 0}.
* </ul>
*
* @param obj an object to be tested for equality
*** 224,239 ****
public int hashCode() {
return isPresent ? Double.hashCode(value) : 0;
}
/**
! * Returns a non-empty string representation of this OptionalDouble suitable for
* debugging. The exact presentation format is unspecified and may vary
* between implementations and versions.
*
* @implSpec If a value is present the result must include its string
! * representation in the result. Empty and present OptionalDoubless must be
* unambiguously differentiable.
*
* @return the string representation of this instance
*/
@Override
--- 224,241 ----
public int hashCode() {
return isPresent ? Double.hashCode(value) : 0;
}
/**
! * {@inheritDoc}
! *
! * Returns a non-empty string representation of this object suitable for
* debugging. The exact presentation format is unspecified and may vary
* between implementations and versions.
*
* @implSpec If a value is present the result must include its string
! * representation in the result. Empty and present instances must be
* unambiguously differentiable.
*
* @return the string representation of this instance
*/
@Override