什么是Java相当于.NET的IEquatable&LT的; T>接口? [英] What is the Java equivalent of .NET's IEquatable<T> Interface?

查看:275
本文介绍了什么是Java相当于.NET的IEquatable&LT的; T>接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是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...

这篇关于什么是Java相当于.NET的IEquatable&LT的; T&GT;接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆