Is List.iterator() thread-safe?

后端 未结 3 766
误落风尘
误落风尘 2020-12-05 14:14

In Java: Is List.iterator() thread-safe, i.e. does the returned iterator reflect the current state of the list at any time or just the state of the list at the

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 14:59

    It depends on what class you use,

    not for Collections.synchronizedList(new ArrayList<>()); reason but

    for CopyOnWriteArrayList reason.

    best Description here

提交回复
热议问题