Implementing a Queue

LinkedList queue = new LinkedList(); // Add to end of queue queue.add(object); // Get head of queue Object o = queue.removeFirst(); // If the queue is to be used by multiple threads, // the queue must be wrapped with code to synchronize the methods queue = (LinkedList)Collections.synchronizedList(queue);

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.