Use Collections.synchronizedList()
.
Ex:
Collections.synchronizedList(new ArrayList<YourClassNameHere>())
More Related Contents:
- Why do I need to synchronize a list returned by Collections.synchronizedList
- When to use LinkedList over ArrayList in Java?
- Initialization of an ArrayList in one line
- How do I remove repeated elements from ArrayList?
- Sorting an ArrayList of objects using a custom sorting order
- Avoid synchronized(this) in Java?
- Converting ‘ArrayList to ‘String[]’ in Java
- Is multi-thread output from System.out.println interleaved
- How to count the number of occurrences of an element in a List
- How to find an object in an ArrayList by property
- How to sort an ArrayList in Java [duplicate]
- Which Java Collection should I use?
- How to synchronize a static variable among threads running different instances of a class in Java?
- How do synchronized static methods work in Java and can I use it for loading Hibernate entities?
- Java double checked locking
- How to sort an ArrayList using multiple sorting criteria?
- Java Synchronized Block for .class
- Java Singleton and Synchronization
- Waiting on multiple threads to complete in Java
- Concurrent threads adding to ArrayList at same time – what happens?
- What is the difference between a synchronized method and synchronized block in Java? [duplicate]
- Best way to create a hashmap of arraylist
- Collections.synchronizedList and synchronized
- How to remove element from ArrayList by checking its value?
- Correct way to synchronize ArrayList in java
- ArrayList filter [duplicate]
- What is the Simplest Way to Reverse an ArrayList?
- Vector vs Collections.synchronizedList(ArrayList)
- Does the capacity of ArrayList decrease when we remove elements?
- How to sort Arraylist of objects