I'd like to create synchronized ArrayList in JAVA. I've used this code:
static ArrayList<User> listOfUsers = Collections.synchronizedList(new ArrayList<User>());
But NetBeans yells:
incompatible types:
required: ArrayList found: List
Any help possible?
Collections.synchronizedList() returns a List, not an ArrayList. Declare the user list as such:
static List<User> listOfUsers = Collections.synchronizedList(new ArrayList<User>());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With