WEBINAR:
On-Demand
Building the Right Environment to Support AI, Machine Learning and Deep Learning
The java.util.list is not thread safe by default. There can be situations where you would want to use the list in a multithreaded environment for processing.
An effective mechanism is to use Collections.synchronizedList(ordinaryList) where ordinaryList is a normal list. The return value of this invocation is a thread safe list which can be used as desired.
// Creating a safeList that will be thread safe
List safeList = Collections.synchronizedList(ordinaryList);
Visit the DevX Tip Bank