What's the difference between HashSet and Set?

前端 未结 8 2038
独厮守ぢ
独厮守ぢ 2020-12-12 19:01

Saw the code snippet like

Set instances = new HashSet();

I am wondering if Hashset is a special kind of set. A

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 19:19

    Set is a parent interface of all set classes like TreeSet, LinkedHashSet etc.

    HashSet is a class implementing Set interface.

提交回复
热议问题