Can ArrayList be used for readonly purpose in multithreaded environment?

后端 未结 2 1375
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-14 16:03

I have few ArrayList containing user defined objects (e.g. List, List). The objects are immutable in nature

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-14 16:48

    Yes, you should be able to pass the array into each thread. There should be no access errors so long as the array is finished being written to before any thread is possibly getting the information.

提交回复
热议问题