开发者

list datatype in java which dosen't add duplicates

Is there any list datatype in java which dosen't add duplicates. I am not worried about the开发者_StackOverflow order in which they are inserted in the list but I would like to have a list which dosen't add duplicates. Or might be the case if the same element is present it just overrites it. Is there something already build in JDK or might be in apache commons package.


You're looking for a HashSet<T>.
If you don't want reference equality, you'll need to override equals() and hashCode().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜