• Advertisement
Sign in to follow this  

[java] Can't find Collections.synchronizedList

This topic is 2775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to create a synchronizedList, but it's as if the methiod isn't in the collections framework. I'm using the latest JDK and NetBeans 6.9.

The compiler just says it 'can't find class Collections.synchronizedList'.

The exact line is (cut and pasted from my code):

List list = new Collections.synchronizedList(new ArrayList<String>());


I've made sure I'm importing java.awt.List, java.util.ArrayList and java.util.Collections

I've tried looking online for examples of a synchronizedList they all seem to be done exactly as I have above, I can't see that I've got anything wrong.

Help!

Share this post


Link to post
Share on other sites
Advertisement
According to the Documentation the method is static. Removing the new-Keyword should fix your problem.

List list = Collections.synchronizedList(new ArrayList<String>());


[Edited by - Noobico on July 20, 2010 9:04:03 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement