官术网_书友最值得收藏!

Using a HashSet

The best way to describe a HashSet is by describing how it's implemented: HashMap<K, ()>. It's just a HashMap without any values!

The two best reasons to choose a HashSet are:

  • You don't want to deal with duplicate values at all, as it doesn't even include them.
  • You plan on doing a lot (and I mean a lot) of item lookup - that is the question, Does my collection contain this particular item?. In a vector, this is done in , while a HashSet can do it in .
主站蜘蛛池模板: 额济纳旗| 雅江县| 延寿县| 丰原市| 贵德县| 吉木萨尔县| 布拖县| 习水县| 陆良县| 锦屏县| 龙川县| 安新县| 彩票| 三台县| 微山县| 湟中县| 溆浦县| 通州区| 绥德县| 安仁县| 贵定县| 比如县| 安化县| 砚山县| 乌拉特中旗| 昌黎县| 彭州市| 崇文区| 吕梁市| 邵阳县| 班玛县| 古交市| 赣州市| 县级市| 惠水县| 孝昌县| 丁青县| 新晃| 恭城| 华池县| 石屏县|