equals.Object | R Documentation |
Compares an object with another and returns TRUE
if they are equal.
The equal property must be
1) reflexive, i.e. equals(o1,o1)
should be TRUE
.
2) symmetric, i.e. equals(o1,o2)
is TRUE
if and only
if equals(o2,o1)
is TRUE
.
3) transitive, i.e. equals(o1,o2)
is TRUE
and
equals(o2,o3)
is TRUE
, then equals(o1,o3)
should
be TRUE
.
5) consistent, i.e. equals(o1,o2)
should return the same
result on multiple invocations as long as nothing has changed.
6) equals(o1,
NULL
)
should return FALSE
, unless
o1
is also NULL
.
By default, the method returns TRUE
if and only if the two
references compared refer to the same Object
, i.e.
( !is.null(obj) && (hashCode(this) == hashCode(obj)) )
.
## S3 method for class 'Object'
equals(this, other, ...)
other |
The other object this |
... |
Not used. |
Returns TRUE
if the Object's are equal, otherwise FALSE
.
Henrik Bengtsson
*hashCode()
.
For more information see Object
.
o1 <- Object()
o2 <- clone(o1)
equals(o1, o1) # TRUE
equals(o1, o2) # FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.