与HashMap相比,使用HashSet的优点 [英] Advantages of using a HashSet over HashMap

查看:133
本文介绍了与HashMap相比,使用HashSet的优点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据JavaDoc API,HashSet只是HashMap的包装.因此,与HashMap相比,使用HashSet可能会带来任何性能优势.曾经?曾经?还是只是拥有适合其他情况的其他API?

According to JavaDoc API a HashSet is just a wrapper around a HashMap. Therefore can there ever be any performance benefit to using a HashSet over a HashMap. Ever? Ever? Or is just to have a different API which suits other cases?

推荐答案

不,没有性能"上的好处;使用正确的API解决正确的问题只是带来了好处...这是相当可观的.

No, there's no "performance" benefit; there's just the benefit that comes from using the right API for the right problem...which is considerable.

这篇关于与HashMap相比,使用HashSet的优点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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