commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <>
Subject Re: [collections] UnmodifiableBoundedCollection
Date Wed, 31 Mar 2004 21:37:10 GMT
Stephen Colebourne wrote:
> This misunderstands the BoundedCollection interface, which is an interface
> providing extra information about collections with a maximum limited size..

Well, I understand but I used the FixedSizeMap because it also
implements BoundedMap. So I assumed that a FixedSizeMap means
the boundary is always reached. Did I get this wrong?

> // create a buffer that implements the BoundedCollection interface
> BoundedCollection buffer = new BoundedBuffer(16);

// create a BoundedMap
Map m = MapUtils.fixedSizeMap(new HashMap());

> // synchronize it, but this loses the BoundedCollection interface
> Collection sync = SynchronizedCollection.decorate(buffer);

// synchronize it
Map sm = MapUtils.synchronizedMap(m);

> // get back to the bounded collection interface
> BoundedCollection coll = UnmodifiableBoundedCollection.decorateUsing(sync);

But why is this needed? Both decorators are still being used.
...although the object itself does not implement
the BoundedMap/Collection interface anymore. So the
UnmodifiableBoundedCollection is only to bring the
interface back?

Is that what you mean?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message