什么是Java相当于.NET的IEquatable接口?
What is the Java equivalent of .NET's IEquatable Interface?
不幸的是,我不相信有一个 - 这是在提供哈希映射等定制的相等比较而言痛苦:(
Unfortunately I don't believe there is one - which is a pain in terms of providing hash maps etc with custom equality comparisons :(
显然有可比< T>
作为等同于 IComparable的< T>
和比较< T>
为的IComparer< T>
,但我不相信有任何相等于的IEqualityComparer< T>
和 IEquatable< T>
Obviously there's Comparable<T>
as an equivalent to IComparable<T>
and Comparator<T>
for IComparer<T>
, but I don't believe there's any equivalent of IEqualityComparer<T>
and IEquatable<T>
.
有可能是第三方库提供相同的排序界面和地图的哪些使用,当然他们......
There may be third party libraries providing the same sort of interface and maps which use them of course...