Wendy Smoak wrote:
I put together a simple example that demonstrates the problem:
http://wiki.wendysmoak.com/cgi-bin/wiki.pl?CircularFifoBuffer
Bug? Surely I'm not doing anything wrong by calling remove(...) on a
Collection? (Inefficient though it may be, first I just want to see it
work.)
From: Stephen Colebourne [EMAIL PROTECTED]
Your wiki indicates that this is solved in SVN. Is this the case?
It looks like it. I only got as far as creating the test case and seeing it
NOT fail. (After I posted the original message.) I need the LRU behavior,
though, so I don't think
Tim,
I'm using your suggestion, and thanks for providing a complete example! I
needed that. :)
(It's here if anyone needs to refer to it:
http://www.mail-archive.com/commons-user%40jakarta.apache.org/msg11963.html )
As written, however, it doesn't rearrange the values when you re-visit an
item.
From: Tim O'Brien [EMAIL PROTECTED]
Or you could do something that takes more work, but I think it more fun:
A belated thank you for the suggestions... I haven't gotten back around to
working on this requirement yet, but I'm sure one or more of the things in
this thread will help
Wendy, you could most certainly use a LRUMap with a fixed size. Give
each item a unique key and let the Map take care of uniqueness. LRUMap
will take care of discarding the least recently used entry once it
reached the maximum defined size, and the Iterator returns most recently
used to
Tim O'Brien wrote:
Wendy, you could most certainly use a LRUMap with a fixed size. Give
each item a unique key and let the Map take care of uniqueness.
LRUMap will take care of discarding the least recently used entry once
it reached the maximum defined size, and the Iterator returns most
Possibly it could also be a MRU (Most Recently Used) cache.
At 2005-07-03 23:39, you wrote:
I'd say you were looking for an ordinary priority queue, where the
priority=the timestamp. Try the Heap class.
Sincerely,
Silas Snider
On 7/3/05, Wendy Smoak [EMAIL PROTECTED] wrote:
I'm looking
Hmmm
* Ordered
* No duplicates
* Max Size
icky
Buffer boundedBuffer = new BoundedFifoBuffer(10);
Predicate uniqueness = new UniquePredicate();
Buffer buffer = new PredicatedBuffer( boundedBuffer, uniqueness );
/icky
Then you can iterate over the content's of the Buffer. But, that might
I'd say you were looking for an ordinary priority queue, where the
priority=the timestamp. Try the Heap class.
Sincerely,
Silas Snider
On 7/3/05, Wendy Smoak [EMAIL PROTECTED] wrote:
I'm looking through the Collections API, but not finding exactly what I
want... hoping someone who's more