What is the Java equivalent of .NET’s IEquatable Interface?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately I don’t believe there is one – which is a pain in terms of providing hash maps etc with custom equality comparisons 🙁
Obviously there’s
Comparable<T>as an equivalent toIComparable<T>andComparator<T>forIComparer<T>, but I don’t believe there’s any equivalent ofIEqualityComparer<T>andIEquatable<T>.There may be third party libraries providing the same sort of interface and maps which use them of course…