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

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 .
主站蜘蛛池模板: 秀山| 辽阳县| 天峨县| 孝义市| 汕头市| 南开区| 潞城市| 民乐县| 报价| 两当县| 荥经县| 芷江| 上林县| 海安县| 凉山| 达日县| 万盛区| 财经| 张家港市| 耿马| 虎林市| 石城县| 灌云县| 山阴县| 隆林| 阿克苏市| 烟台市| 车险| 肇源县| 阿克苏市| 罗平县| 个旧市| 荆门市| 陈巴尔虎旗| 全椒县| 蒙阴县| 汉源县| 铜山县| 永春县| 方城县| 烟台市|