Given:
What is the output?
List.indexOf returns -1 when no element is equal to the search object. Because Product does not override equals, the two distinct Product instances are not equal despite having the same id and name values.
List.indexOf
-1
Product
equals
id
name
Community Discussion