Force a class to override the .equals method
问题 I have a bunch of class who implement a common interface : Command. And this bunch of class goes to a Map. To get the Map working correctly, I need to each class who implements Command to override the Object.equals(Object other) method. it's fine. But i whould like to force the overriding of equals. => Have a compilation error when something who implement command dont override equals. It's that possible ? Edit : BTW , i will also need to forcing the override of hashcode... 回答1: No, you can't.