Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

hashCode.Object

Gets a hash code for the Object


Description

Gets a hash code for the Object. This makes it possible to put any Object in a hash table.

The hash code returned must:

1) be consistent, i.e. hashCode(obj) should return the same value on multiple invocations as long as nothing has changed.

2) tell same same thing as equals(), if equals(o1,o2) is TRUE, then hashCode(o1) == hashCode(o2) should also be TRUE.

Note that if equals(o1,o2) is FALSE, hashCode(o1) hashCode(o2) may be either equal or non-equal.

By default, the method returns the internal memory address where the Object is located.

Usage

## S3 method for class 'Object'
hashCode(this, ...)

Arguments

...

Not used.

Value

Returns a double.

Author(s)

Henrik Bengtsson

See Also

*equals() For more information see Object.

Examples

obj <- Object()
  hashCode(obj)          # 26979608

R.oo

R Object-Oriented Programming with or without References

v1.24.0
LGPL (>= 2.1)
Authors
Henrik Bengtsson [aut, cre, cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.