I'm trying to find the definitive documentation on how to use a custom object as the key for HashMap or as the object stored in HashSet.
From reading various postings, I've somehow discovered that you're supposed to override the two methods equals() and hashCode() in the custom object (e.g. Overriding equals and hashCode in Java).
However, when I read the Oracle/Sun official Javadocs for HashSet and HashMap, they do not mention overriding these methods at all. Are these instructions buried somewhere else in the documentation? If so, where can I find them?