posted 15 years ago
Hi,
I'm trying to represent a relational database and its tables, so I have a class representing a database, and a class representating a table.
In the database class, there is a Set, containing Table objects, as I know that no two tables can have the same name within my database (ignoring more complex database structures for now...)
I can think of two equals() implementations that seem valid. I need to return true if two tables have the same name, so as to ensure no duplicate names in my collection, so that's one. However, if I do that, two table objects will be equal even if they contain different attributes and columns, so a direct comparison of two tables will be misleading.
Any thoughts on how to approach this best?
Many thanks,
"The important thing is not to stop questioning."