Java入门6.3---操作集合的工具类Collections

2.Enumeration(了解)

Enumeration接口是Iterator迭代器的“古老版本”。与Enumeration相比,Iterator更加安全,因为当一个集合正在被遍历的时候,它会阻止其他线程取修改集合。

区别:

  1. Iterator的⽅法名比Enumeration更科学
  2. Iterator有fail-fast机制,比Enumeration更安全
  3. Iterator能够删除元素,Enumeration并不能删除元素

Java入门6.3---操作集合的工具类Collections

 

相关文章:

  • 2022-02-20
  • 2021-07-13
  • 2021-09-02
  • 2021-04-29
  • 2022-12-23
  • 2023-02-03
猜你喜欢
  • 2021-10-02
  • 2021-11-08
  • 2022-01-06
  • 2021-12-25
  • 2021-10-25
相关资源
相似解决方案