|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<T>
org.ka2ddo.util.ShareableObjectCache<T>
public abstract class ShareableObjectCache<T>
This class provides an alternative to the Java PermGen heap section used for String.intern(), such that applications won't run out of Java PermGen space while still being able to share constant object declarations.
Constructor Summary | |
---|---|
protected |
ShareableObjectCache()
Constructs a new, empty ShareableObjectCache with the default initial capacity (16) and load factor (2.0). |
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. |
Method Summary | |
---|---|
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()
|
T |
internKey(T t)
|
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 representation of this collection. |
Methods inherited from class java.util.AbstractSet |
---|
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, contains, containsAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
addAll, contains, containsAll, retainAll, toArray, toArray |
Constructor Detail |
---|
protected ShareableObjectCache(int initialCapacity, float loadFactor)
initialCapacity
- The initial capacity of the ShareableObjectCacheloadFactor
- The load factor of the ShareableObjectCache
java.lang.IllegalArgumentException
- if the initial capacity is negative,
or if the load factor is nonpositive.protected ShareableObjectCache(int initialCapacity)
initialCapacity
- The initial capacity of the ShareableObjectCache
java.lang.IllegalArgumentException
- if the initial capacity is negativeprotected ShareableObjectCache()
Method Detail |
---|
public int size()
size
in interface java.util.Collection<T>
size
in interface java.util.Set<T>
size
in class java.util.AbstractCollection<T>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<T>
isEmpty
in interface java.util.Set<T>
isEmpty
in class java.util.AbstractCollection<T>
public boolean add(T key)
add
in interface java.util.Collection<T>
add
in interface java.util.Set<T>
add
in class java.util.AbstractCollection<T>
key
- key with which the specified value is to be associated.
public T internKey(T t)
public boolean remove(java.lang.Object key)
(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 map
public void clear()
clear
in interface java.util.Collection<T>
clear
in interface java.util.Set<T>
clear
in class java.util.AbstractCollection<T>
protected abstract java.lang.Class getType()
public java.lang.String toString()
String.valueOf(Object)
.
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>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |