| java.util.AbstractSet org.cojen.util.WeakCanonicalSet
All known Subclasses: org.cojen.util.WeakFlyweightSet,
WeakCanonicalSet | public class WeakCanonicalSet extends AbstractSet (Code) | | A thread-safe Set that manages canonical objects: sharable objects that are
typically immutable. Call the
WeakCanonicalSet.put put method for supplying the
WeakCanonicalSet with candidate canonical instances.
Objects that do not customize the hashCode and equals methods don't make
sense to be canonicalized because each instance will be considered unique.
The object returned from the
WeakCanonicalSet.put put method will always be the same
as the one passed in.
author: Brian S O'Neill |
WeakCanonicalSet | public WeakCanonicalSet()(Code) | | |
contains | public synchronized boolean contains(Object obj)(Code) | | |
put | public synchronized Object put(Object obj)(Code) | | Pass in a candidate canonical object and get a unique instance from this
set. The returned object will always be of the same type as that passed
in. If the object passed in does not equal any object currently in the
set, it will be added to the set, becoming canonical.
Parameters: obj - candidate canonical object; null is also accepted |
|
|