Tuesday 12 March 2013

doubleValue() Returns: the double value represented by this object is converted to type float and the result of the conversion is returned.


doubleValue()

Returns: the double value represented by this object is converted to type float and the result of the
conversion is returned.
Since: JDK1.0
doubleValue()
Declaration:
public double doubleValue()
Description:
Returns the double value of this Double.
Returns: the double value represented by this object.
hashCode()
Declaration:
public int hashCode()
Description:
Returns a hashcode for this Double object. The result is the exclusive OR of the two halves of the long
integer bit representation, exactly as produced by the method doubleToLongBits(double), of the
primitive double value represented by this Double object. That is, the hashcode is the value of the
expression:
(int)(v^(v>>>32))
where v is defined by:
long v = Double.doubleToLongBits(this.doubleValue());
Overrides: hashCode in class Object
Returns: a hash code value for this object.
equals(Object)
Declaration:
public boolean equals(java.lang.Object obj)
Description:
Compares this object against the specified object. The result is true if and only if the argument is not
null and is a Double object that represents a double that has the identical bit pattern to the bit pattern of
the double represented by this object. For this purpose, two double values are considered to be the same if
and only if the method doubleToLongBits(double) returns the same long value when applied to
each.
Note that in most cases, for two instances of class Double, d1 and d2, the value of d1.equals(d2) is
true if and only if
d1.doubleValue() == d2.doubleValue()
also has the value true. However, there are two exceptions:
• If d1 and d2 both represent Double.NaN, then the equals method returns true, even though
Double.NaN==Double.NaN has the value false.
• If d1 represents +0.0 while d2 represents -0.0, or vice versa, the equals test has the value
false, even though +0.0==-0.0 has the value true. This allows hashtables to operate properly.

No comments:

Post a Comment