List vs List iterator

后端 未结 6 1035
清酒与你
清酒与你 2021-01-06 02:51

I have one list:

List myList = new ArrayList();


To get from this list there are two methods:

1.

<
6条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-06 03:39

    First one is more clear, but if you want to remove elements while visiting the list your only choice is an iterator.

提交回复
热议问题