33

HashSet和TreeSet的区别-奔跑吧爽爽的博客-51CTO博客

 6 years ago
source link: http://blog.51cto.com/13579086/2069837
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
HashSet无序(存入和取出的顺序不同),不重复,无索引底层是哈希表结构,也称散列表结构,查找和删除快,添加慢像HashSet中存储自定义对象需要重写hashCode()和equals()方法importjava.util.HashSet;importjava.util.Iterator;/***演示HashSet是如何保证元素的唯一性的*@authorWangShuang**/publiccl

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK