Top "Equals" questions

Refers to Java equals method, indicating whether some object is "equal to" this one.

How should equals and hashcode be implemented when using JPA and Hibernate

How should model class's equals and hashcode be implemented in Hibernate? What are the common pitfalls? Is the default implementation …

java hibernate orm equals hashcode
Why assertEquals and assertSame in junit return the same result for two instances same class?

According to documentation assertEquals() Asserts that two objects are equal. assertSame() Asserts that two objects refer to the same object. …

java junit equals assert
Can I check strings equality in lua?

Just a straight forward beginner question, I am coding Lua stuff for Garrys Mod, learning by reading wiki and other …

string lua comparison equals
Compare Date object with a TimeStamp in Java

When I test this code: java.util.Date date = new java.util.Date(); java.util.Date stamp = new java.sql.…

java date timestamp compare equals
Is it a bad idea if equals(null) throws NullPointerException instead?

The contract of equals with regards to null, is as follows: For any non-null reference value x, x.equals(null) …

java null equals nullpointerexception
Equals(item, null) or item == null

Is code that uses the static Object.Equals to check for null more robust than code that uses the == operator …

c# null equals robustness
Why can't we use '==' to compare two float or double numbers

I am reading Effective java by Joshua Bloch and in Item 8: Obey the general contract when overriding equals, this statement …

java floating-point double equals
Groovy different results on using equals() and == on a GStringImpl

According to the groovy docs, the == is just a 'clever' equals() as it also takes care of avoiding NullPointerException. So, …

groovy equals gstring
toString(), equals(), and hashCode() in an interface

So, I have an interface with a bunch of methods that need to be implemented, the method names are irrelevant. …

java interface equals hashcode tostring
XPath operator "!=". How does it work?

XML document: <doc> <A> <Node>Hello!</Node> </A> <B&…

xpath equals operator-keyword