{"id":2106,"date":"2013-08-20T19:45:34","date_gmt":"2013-08-20T17:45:34","guid":{"rendered":"http:\/\/www.tutego.de\/blog\/javainsel\/?p=2106"},"modified":"2013-08-20T19:45:34","modified_gmt":"2013-08-20T17:45:34","slug":"google-guava-evictingqueue-in-version-15","status":"publish","type":"post","link":"https:\/\/www.tutego.de\/blog\/javainsel\/2013\/08\/google-guava-evictingqueue-in-version-15\/","title":{"rendered":"Google Guava: EvictingQueue in Version 15"},"content":{"rendered":"<p><a href=\"https:\/\/plus.google.com\/118010414872916542489\">Google Guava<\/a> <a href=\"https:\/\/plus.google.com\/118010414872916542489\/posts\/QVqQGiSppF3\">hat Folgendes urspr\u00fcnglich geteilt<\/a>:<\/p>\n<blockquote>\n<p><b>EvictingQueue: a non-blocking, bounded queue<\/b>       <br \/>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.       <br \/>Java provides several Queue implementations, depending on what features you need. For example:       <br \/>Unbounded, non-blocking: ArrayDeque, LinkedList, PriorityQueue       <br \/>Unbounded, blocking: LinkedBlockingDeque, LinkedBlockingQueue, SynchronousQueue       <br \/>Bounded, blocking: ArrayBlockingQueue, LinkedBlockingDeque, LinkedBlockingQueue       <br \/>However, a bounded, non-blocking implementation is noticeably missing from the JDK. Like many of the JDK implementations, EvictingQueue is <i>not<\/i> thread-safe and does <i>not<\/i> 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.       <br \/>An EvictingQueue can be used to keep track of recent items in a bounded buffer, or even as a simple FIFO cache. Hopefully you\u2019ll find it useful!       <br \/>Cheers,       <br \/>-+<a href=\"https:\/\/plus.google.com\/104176937291281778869\">Kurt Alfred Kluever<\/a>, Guavian       <br \/>[1] <a href=\"http:\/\/docs.guava-libraries.googlecode.com\/git\/javadoc\/com\/google\/common\/collect\/EvictingQueue.html\">http:\/\/docs.guava-libraries.googlecode.com\/git\/javadoc\/com\/google\/common\/collect\/EvictingQueue.html<\/a>       <br \/>[2] <a href=\"https:\/\/code.google.com\/p\/guava-libraries\/wiki\/LivingWithNullHostileCollections\">https:\/\/code.google.com\/p\/guava-libraries\/wiki\/LivingWithNullHostileCollections<\/a><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Google Guava hat Folgendes urspr\u00fcnglich 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[67,4],"tags":[],"class_list":["post-2106","post","type-post","status-publish","format-standard","hentry","category-guavagoogle-core-libraries","category-open-source"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/2106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/comments?post=2106"}],"version-history":[{"count":1,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/2106\/revisions"}],"predecessor-version":[{"id":2107,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/2106\/revisions\/2107"}],"wp:attachment":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/media?parent=2106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/categories?post=2106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/tags?post=2106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}