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.

String equality with null handling

I will often use this code to compare a string: if(!string.IsNullOrEmpty(str1) && str1.Equals(str2)){ //they …

c# .net string null equality
Comparing two List<string> for equality

Other than stepping through the elements one by one, how do I compare two lists of strings for equality (in .…

c# .net collections comparison equality
How to check if two vars have the same reference?

How can you check if two or more objects/vars have the same reference?

javascript equality
What's the difference between eq, eql, equal and equalp, in Common Lisp?

What's the difference between eq, eql, equal and equalp, in Common Lisp? I understand that some of them check types, …

syntax common-lisp equality
How to test for (ActiveRecord) object equality

In Ruby 1.9.2 on Rails 3.0.3, I'm attempting to test for object equality between two Friend (class inherits from ActiveRecord::Base) objects. …

ruby-on-rails ruby activerecord identity equality
Determining Date Equality in Javascript

I need to find out if two dates the user selects are the same in Javascript. The dates are passed …

javascript date equality
Testing for equality between dictionaries in c#

Assuming dictionary keys and values have their equals and hash methods implemented correctly, what is the most succinct and efficient …

c# dictionary equality
Why can a Python dict have multiple keys with the same hash?

I am trying to understand the Python hash function under the hood. I created a custom class where all instances …

python hash dictionary set equality
Using a class versus struct as a dictionary key

Suppose I had the following class and structure definition, and used them each as a key in a dictionary object: …

c# class dictionary struct equality
How to compare two strings in scala?

I want to compare two strings in scala. for example, My Strings are: scala java scala java c++ scala c++ …

string scala equality