Mega Code Archive

 
Categories / Java / Collections Data Structure
 

Wrap queue to synchronize the methods

import java.util.Collections; import java.util.LinkedList; public class Main {   public static void main(String[] argv) throws Exception {     LinkedList queue = new LinkedList();     Object object = "";     queue.add(object);     Object o = queue.removeFirst();     queue = (LinkedList) Collections.synchronizedList(queue);   } }