Need to clarify how objects are compared by collection classes
-
Key: ALF12-2
-
Legacy Issue Number: 16598
-
Status: open
-
Source: IBM ( Mattias Mohlin)
-
Summary:
Several of the operations in the collection classes require that two general objects can be compared for equality (one example is Collection::includes).
The standard should clarify how the equality comparison is done. Will the equality operator == always be used, or is it possible for the user to define the condition for how to compare objects of a user-defined class?
If the equality operator == is used for all objects, this will limit the usefulness of the collection library. For some kinds of objects a comparison based on object identity is not appropriate.
We propose that object identity comparisons is only the default for class objects, and that it can be customized by defining an equals operation in the class. -
Reported: ALF 1.0b1 — Fri, 14 Oct 2011 04:00 GMT
-
Updated: Tue, 14 Jul 2020 19:26 GMT