Google Guava: EvictingQueue in Version 15
Google Guava hat Folgendes ursprünglich geteilt:
EvictingQueue: a non-blocking, bounded queue In Guava 15, we are introducing EvictingQueue [1], which is a non-blocking, bounded queue that automatically evicts (removes) elements from the head of the queue when attempting to add elements to a full queue. This is different from conventional bounded queues, which either block or reject new elements when full. Java provides several Queue implementations, depending on what features you need. For example: Unbounded, non-blocking: ArrayDeque,
LinkedList, PriorityQueue Unbounded, blocking: LinkedBlockingDeque, LinkedBlockingQueue, SynchronousQueue Bounded, blocking: ArrayBlockingQueue, LinkedBlockingDeque, LinkedBlockingQueue However, a bounded, non-blocking implementation is noticeably missing from the JDK. Like many of the JDK implementations, EvictingQueue is not thread-safe and does not permitnullelements. If you need thread safety, you must wrap it in a synchronized wrapper (Queues#synchronizedQueue). If you neednullelements, please give this wiki page [2] a read. An EvictingQueue can be used to keep track of recent items in a bounded buffer, or even as a simple FIFO cache. Hopefully you’ll find it useful! Cheers, -+Kurt Alfred Kluever, Guavian [1]
[2]
1 Kommentare
Interesting Java-related links for September 2 - September 8, 2013 - Softteco ·
\[…\] http://www.tutego.de/blog/javainsel/2013/08/google-guava-evictingqueue-in-version-15/ – Some Guava goodness \[…\]
Die bisherigen Kommentare wurden aus WordPress übernommen. Neue Kommentare sind derzeit geschlossen.