HashSet vs LinkedHashSet

后端 未结 10 2539
暗喜
暗喜 2020-11-28 18:20

What is the difference between them? I know that

A LinkedHashSet is an ordered version of HashSet that maintains a doubly-linked List across all el

10条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 18:52

    All Methods and constructors are same but only one difference is LinkedHashset will maintain insertion order but it will not allow duplicates.

    Hashset will not maintain any insertion order. It is combination of List and Set simple :)

提交回复
热议问题