iterate EvictingQueue backwards
See original GitHub issueEvictingQueue
is mostly a wrapper over ArrayDeque
which have a descendingIterator
.
EvictingQueue
’s only constructor is private
, so I can’t extend the class.
And delegate()
is also protected.
Either the constructor should be made protected
or delegate
public
, I think, so I could do what I want
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
c# - how to reverse iterate over Queue? - Stack Overflow
You could use Linq's Reverse() function: Queue myQueue; foreach (var item in myQueue.Reverse()) { // do things }.
Read more >Iterate over a Queue in Java | Techie Delight
This post will discuss various methods to iterate through a queue in Java. As `Queue` implements `Iterable` interface, we can use enhanced for-loop...
Read more >Iterating Backward Through a List - Baeldung
In this quick tutorial, we'll learn about various ways in which we can iterate backward through a list in Java.
Read more >Size-limited queue that holds last N elements in Java - Intellipaat
Guava now has an EvictingQueue, a non-blocking queue which automatically evicts elements from the head of the queue when attempting to add new...
Read more >Uses of Class com.google.common.annotations.GwtCompatible ...
A function from A to B with an associated reverse function from B to A ; used for converting ... A Multiset implementation...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think we’d want to hear some use cases first for why you’d want to iterate an
EvictingQueue
backwards before we make any changes.✋ use case here! I wanted to use an
EvictingQueue
to keep around the most recent N items. When I need to process (not remove) items from the queue, I’m only interested in the most recent items which may or may not be all N items. e.g. I may keep around 20 things but might only be interested in the most recent 10 right now. There’s no easy way to do this withEvictingQueue
, so I’m forced to use anotherDeque
implementation and manually evict things when necessary.