Chris et all,

Do you see any problems overriding the default equals, and hashCode methods in 
the Product class (checking by memory address/reference) to something that 
checks to see if the products logically represent the same thing (same id, 
name, etc)?

My issue is the following, I receive data back from the database, with multiple 
lines representing a single product (this is a database thing, and the desired 
behavior).  Thus if I iterate across the results, I will get multiple Product 
objects that represent one real Product (and contain equivalent member 
variables).  In essence they are the same "Product".  I can write cleaner, 
faster, code to combine the results, if I can test them for equality and hash 
them directly, without first pulling out the productName, or Id.

This will be a problem if there is some code that expects two "Products" that 
have identical member variables to fail the equality test if they are distinct 
objects.

Thanks,

-Michael





Reply via email to