什么是Java相当于.NET的IEquatable&LT的; T&GT;接口? [英] What is the Java equivalent of .NET's IEquatable<T> Interface?
问题描述
什么是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 :(
显然有可比&LT; T&GT;
作为等同于 IComparable的&LT; T&GT;
和比较&LT; T&GT;
为的IComparer&LT; T&GT;
,但我不相信有任何相等于的IEqualityComparer&LT; T&GT;
和 IEquatable&LT; T&GT;
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...
这篇关于什么是Java相当于.NET的IEquatable&LT的; T&GT;接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!