commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject Re: [collections] UnmodifiableBoundedCollection
Date Wed, 31 Mar 2004 21:50:39 GMT
From: "Torsten Curdt" <tcurdt@vafer.org>
> 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?

Ah, I'd forgotten about BoundedMap ;-) FixedSizeMap does implement
BoundedMap, and as the size is fixed, the map is always at the bound.

> 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?

UnmodifiableBoundedCollection is used when you need to access the
BoundedCollection interface, but you only have a Collection. Casting is no
good as the original bounded collection may have been decorated.
UnmodifiableBoundedCollection wraps the collection you do have with a thin
wrapper that tunnels through to the original BoundedCollection.

And there is no equivalent for BoundedMap at present.

Stephen


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


Mime
View raw message