What's the difference between HashSet and Set?

前端 未结 8 2031
独厮守ぢ
独厮守ぢ 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:28

    HashSet is a class derived from Set interface. As a derived class of Set, the HashSet attains the properties of Set. Important and the most frequently used derived classes of Set are HashSet and TreeSet.

提交回复
热议问题