public class WeakCanonicalSet<T> extends AbstractSet<T>
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 put method will always be the same
as the one passed in.
| Constructor and Description |
|---|
WeakCanonicalSet() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Object obj) |
protected boolean |
equals(Object a,
Object b) |
protected int |
hashCode(Object obj) |
Iterator<T> |
iterator()
Iterator is only thread safe if accessed while synchronized on WeakCanonicalSet
instance.
|
<U extends T> |
put(U obj)
Pass in a candidate canonical object and get a unique instance from this
set.
|
int |
size() |
String |
toString() |
equals, hashCode, removeAlladd, addAll, clear, containsAll, isEmpty, remove, retainAll, toArray, toArraypublic <U extends T> U put(U obj)
obj - candidate canonical object; null is also acceptedpublic Iterator<T> iterator()
public int size()
size in interface Collection<T>size in interface Set<T>size in class AbstractCollection<T>public boolean contains(Object obj)
contains in interface Collection<T>contains in interface Set<T>contains in class AbstractCollection<T>public String toString()
toString in class AbstractCollection<T>protected int hashCode(Object obj)
Copyright © 2004-2015 Cojen. All Rights Reserved.