What's the difference between HashSet and Set?

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

    Set is the general interface to a set-like collection, while HashSet is a specific implementation of the Set interface (which uses hash codes, hence the name).

提交回复
热议问题