jargon

Design patterns·Objects, messages and the principles

you put it in a set, put an identical one in, and the set had two of them.

Object equality

Also calledequals and hashCode, value equality vs reference equality, identity vs equality

The distinction between two references pointing at the same object and two objects being considered the same value. Getting it wrong is the standard source of duplicated set members, failed map lookups and tests that pass individually; getting it right means overriding equality and the hash together, and only ever on fields that do not change. Entities are compared by identity and value objects by value, which is the whole practical content of that distinction.

Commonly confused with