Quoting from the javadocs

UnmodifiableBoundedCollection decorates another BoundedCollection  to
ensure it can't be altered.

If a BoundedCollection is first wrapped in some other collection decorator, such as synchronized or predicated, the BoundedCollection nature is lost. The factory on this class will attempt to retrieve the bounded nature by examining the package scope variables.

I wondered why this should be the case so I gave it a try:


        Map sm = MapUtils.synchronizedMap(new HashMap());
        Map m = MapUtils.fixedSizeMap(sm);
        m.put("a","value");

        Map m = MapUtils.fixedSizeMap(new HashMap());
        Map sm = MapUtils.synchronizedMap(m);
        sm.put("a","value");

Both examples throw an exception as exspected.
Can someone explain why the UnmodifiableBoundedCollection
is needed?

cheers
--
Torsten



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to