Set集合中的值是否重复? [英] Duplicate values in the Set collection?

查看:236
本文介绍了Set集合中的值是否重复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Set集合中允许重复的值?

Is it possible to allow duplicate values in the Set collection?

有没有办法使元素唯一并有一些副本?
Set集合中有重复的值有什么函数吗?

Is there any way to make the elements unique and have some copies of them? Is there any functions for Set collection for having duplicate values in it?

推荐答案

曾经考虑过使用 java.util.List

否则,我建议您使用 Multiset 来自 Google Guava Google Collections 的继任者,这是此答案最初推荐的。)。

Otherwise I would recommend a Multiset from Google Guava (the successor to Google Collections, which this answer originally recommended -ed.).

这篇关于Set集合中的值是否重复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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