HashSet vs LinkedHashSet

后端 未结 10 2526
暗喜
暗喜 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:53

    HashSet: Unordered actually. if u passing the parameter means

    Set set=new HashSet();
    for(int i=0;i

    Out Put: May be 2,1,3 not predictable. next time another order.

    LinkedHashSet() which produce FIFO Order.

提交回复
热议问题