![]() |
The Java Developers Almanac 1.4 |
|
e342. 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);
e344. Implementing a Least-Recently-Used (LRU) Cache e345. Listing the Elements of a Collection e346. Storing Primitive Types in a Collection e347. Creating a Copy of a Collection e348. Making a Collection Read-Only
© 2002 Addison-Wesley. |