You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Michael McKibben <mi...@hihat.net> on 2001/09/20 09:24:14 UTC

Excalibur CircularBuffer not circular!

In looking at the code for CircularBuffer I was quite surprised in learning
that the circular buffer grows by factor of 2 instead of wrapping around on
itself when the content size is > buffer size.

I don't see any benefits with the current behavior over an ArrayList. Do I
not understand correctly the intent of the CircularBuffer class? Also it
seems odd that the CircularBuffer does not implement the
java.util.Collection interface. Is this a legacy class that predates
java.util.Collections? Thanks,

--mike


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Excalibur CircularBuffer not circular!

Posted by Peter Donald <do...@apache.org>.
On Thu, 20 Sep 2001 17:24, Michael McKibben wrote:
> In looking at the code for CircularBuffer I was quite surprised in learning
> that the circular buffer grows by factor of 2 instead of wrapping around on
> itself when the content size is > buffer size.

yep.

> I don't see any benefits with the current behavior over an ArrayList. 

about the only advantage is that when you get something from the front of 
buffer it doesn't cause an array copy like ArrayList would.

> Do I
> not understand correctly the intent of the CircularBuffer class? Also it
> seems odd that the CircularBuffer does not implement the
> java.util.Collection interface. Is this a legacy class that predates
> java.util.Collections? Thanks,

This class is ancient and not actually used anywhere in Avalon so no one has 
actually worked to implement a Collections interface on it ;)

-- 
Cheers,

Pete

---------------------------------------------------
"It is easy to dodge our responsibilities, but we 
cannot dodge the consequences of dodging our 
responsibilities." -Josiah Stamp 
---------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org