Top "Equals" questions

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

How to compare two arrays in Kotlin?

Given some arrays in Kotlin let a = arrayOf("first", "second") val b = arrayOf("first", "second") val c = arrayOf("1st", "2nd") …

arrays equals kotlin
Java - is there a "subclassof" like instanceof?

Im overriding an equals() method and I need to know if the object is an instance of a Event's subclass (…

java subclass equals instanceof
How to implement "equals" method for generics using "instanceof"?

I have a class that accepts a generic type, and I want to override the equals method in a non-awkward …

java oop generics instance equals
Why does "true" == true show false in JavaScript?

MDC describes the == operator as follows: If the two operands are not of the same type, JavaScript converts the operands …

javascript string equals
Is there a __equals method in PHP like there is in Java?

Is there a pattern or magic method you can use in PHP to define when to compare two instances of …

php oop equals
Does Java 7 switch statement with String use equals() method?

Java 7 supports switching with Strings like the code below switch (month.toLowerCase()) { case "january": monthNumber = 1; break; case "february": monthNumber = 2; break; …

java string switch-statement equals
What is the difference between IEqualityComparer<T> and IEquatable<T>?

I want to understand the scenarios where IEqualityComparer<T> and IEquatable<T> should be used. The …

c# .net equals iequalitycomparer iequatable
Linq: What is the difference between == and equals in a join?

I always wondered why there's an equals keyword in linq joins rather than using the == operator. Property deadline = (from p …

c# linq join equals
Comparator and equals()

Suppose I need TreeSet with elements sorted with some domain logic. By this logic it doesn't matter order of some …

java equals comparator treeset
What is the hashCode for a custom class having just two int properties?

In Java, I have a class that represents a point with int coordinates public class Point { int x = -1; int …

java equals hashcode