Illustration einer tropischen Insel mit Palmen und einem hohen Berg

Java Blog für Programmierer

Google Guava: EvictingQueue in Version 15

· Christian Ullenboom

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 permit null elements. If you need thread safety, you must wrap it in a synchronized wrapper (Queues#synchronizedQueue). If you need null elements, 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]

Kategorien: Guava/Google Core Libraries, Open Source

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.

← Alle Beiträge