FAQ Database Discussion Community


Annotating a Java class as safe for reference comparison

java,intellij-idea,equals,equality,multiton
I have a class that's a multiton, so I know that given a particular key, there will never be two instances of the same class that exist. This means that, instead of: if (someObject.equals(anotherObject)) ...it's safe for me to do this: if (someObject == anotherObject) The class is also final,...