I am working on a chemistry package and I have a class which lists all the elements in the periodic table. Ideally the elements will be part of a Java enum. Unfortunately however I need one more element which is to serve as a wildcard : every other element should equal that element. Java does not allow to override the equals() method for enums otherwise I would have done that. Would anyone be able to suggest a reasonable design pattern for the situation that I have just described?
Aucun commentaire:
Enregistrer un commentaire