public abstract class ShareableObjectCache<T>
extends java.util.AbstractSet<T>
| Modifier | Constructor and Description |
|---|---|
protected |
ShareableObjectCache()
Constructs a new, empty
ShareableObjectCache with the default initial
capacity and load factor. |
protected |
ShareableObjectCache(int initialCapacity)
Constructs a new, empty
ShareableObjectCache with the given initial
capacity and the default load factor (2.0). |
protected |
ShareableObjectCache(int initialCapacity,
float loadFactor)
Constructs a new, empty
ShareableObjectCache with the given initial
capacity and the given load factor. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T key)
Associates the specified value with the specified key in this map.
|
void |
clear()
Removes all of the mappings from this map.
|
protected abstract java.lang.Class<?> |
getType()
Get data type of the objects stored in this ShareableObjectCache.
|
T |
internKey(T t)
Look for the specified key in the cache.
|
boolean |
isEmpty()
Returns
true if this set contains no entries. |
java.util.Iterator<T> |
iterator()
Returns an iterator over the elements contained in this collection.
|
boolean |
remove(java.lang.Object key)
Removes the entry for a key from this cache if it is present.
|
int |
size()
Returns the number of key-value mappings in this map.
|
java.lang.String |
toString()
Returns a string description of this collection.
|
addAll, contains, containsAll, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitprotected ShareableObjectCache(int initialCapacity,
float loadFactor)
ShareableObjectCache with the given initial
capacity and the given load factor.initialCapacity - The initial capacity of the ShareableObjectCacheloadFactor - The load factor of the ShareableObjectCachejava.lang.IllegalArgumentException - if the initial capacity is negative,
or if the load factor is nonpositive.protected ShareableObjectCache(int initialCapacity)
ShareableObjectCache with the given initial
capacity and the default load factor (2.0).initialCapacity - The initial capacity of the ShareableObjectCachejava.lang.IllegalArgumentException - if the initial capacity is negativeprotected ShareableObjectCache()
ShareableObjectCache with the default initial
capacity and load factor.public int size()
public boolean isEmpty()
true if this set contains no entries.
This result is a snapshot, and may not reflect unprocessed
entries that will be removed before next attempted access
because they are no longer referenced.public boolean add(T key)
public T internKey(T t)
t - T hashable objectpublic boolean remove(java.lang.Object key)
k
such that (key==null ? k==null :
key.equals(k)), that mapping is removed. (The map can contain
at most one such mapping.)
Returns the value to which this map previously associated the key,
or null if the map contained no mapping for the key. A
return value of null does not necessarily indicate
that the map contained no mapping for the key; it's also possible
that the map explicitly mapped the key to null.
The map will not contain a mapping for the specified key once the call returns.
remove in interface java.util.Collection<T>remove in interface java.util.Set<T>remove in class java.util.AbstractCollection<T>key - key whose mapping is to be removed from the mappublic void clear()
protected abstract java.lang.Class<?> getType()
public java.lang.String toString()
toString in class java.util.AbstractCollection<T>public java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T>iterator in interface java.util.Collection<T>iterator in interface java.util.Set<T>iterator in class java.util.AbstractCollection<T>