Top "Equality" questions

Equality is a relationship between two or more items or variables or objects that exists if (1) the items are the same item, variable, or object or (2) the items are different items, variables or objects but they have the same value.

What is the difference between using IEqualityComparer and Equals/GethashCode Override?

When i am using dictionaries sometimes I have to change the default Equals meaning in order to compare Keys. I …

c# equals equality gethashcode iequalitycomparer
How do you test functions and closures for equality?

The book says that "functions and closures are reference types". So, how do you find out if the references are …

closures swift equality
Can I define custom operator overloads in Javascript?

Is it possible to define custom operators between instances of a type in JavaScript? For example, given that I have …

javascript vector operator-overloading dsl equality
angular2 ngModel/ngValue select option object - equality across different instances

Flavors of this question have been asked numerous times across the various versions of Angular2 prior to release. However, I …

javascript angular equality angular2-forms
Tuple vs string as a Dictionary key in C#

I have a cache that I implement using a ConcurrentDictionary, The data that I need to keep depends on 5 parameters. …

c# .net caching equality concurrentdictionary
Comparing XmlDocument for equality (content wise)

If I want to compare the contents of a XMlDocument, is it just like this? XmlDocument doc1 = GetDoc1(); XmlDocument doc2 = …

c# xml xmldocument equality
Map using tuples or objects

I'm trying to use the new (ES6) Map objects in order to represent a map between properties and a value. …

javascript map equality ecmascript-harmony
How to compare two Strings when both can be null?

I am aware that it is better to call the equals method over using the == operator (see this question). I …

java equals equality
Swift: Overriding == in subclass results invocation of == in superclass only

I've got a class A, which conforms to Equatable protocol and implements == function. In subclass B I override == with more …

swift overriding equality
Is it fine to use JSON.stringify for deep comparisons and cloning?

After attempting several implementations for deep comparison and copying for JSON-serializable objects, I've noticed the fastest often are just: function …

javascript json equality deep-copy object-comparison