T - - type of each element in the collection.public class CachedCollection<T>
extends java.lang.Object
implements java.util.Collection<T>
The cache will be invalidated when data is removed.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Object[] |
cache |
protected java.util.Set<T> |
delegate |
| Constructor and Description |
|---|
CachedCollection(java.util.Set<T> delegate)
Construct a cached collection with the given delegate.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T e) |
boolean |
addAll(java.util.Collection<? extends T> c) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
java.lang.String |
toString() |
protected java.util.Set<T> delegate
protected java.lang.Object[] cache
public CachedCollection(java.util.Set<T> delegate)
Objects are cached before they can be extracted from this collection.
delegate - - the delegate.public int size()
size in interface java.util.Collection<T>public boolean isEmpty()
isEmpty in interface java.util.Collection<T>public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<T>public java.util.Iterator<T> iterator()
public java.lang.Object[] toArray()
toArray in interface java.util.Collection<T>public <T> T[] toArray(T[] a)
toArray in interface java.util.Collection<T>public boolean addAll(java.util.Collection<? extends T> c)
addAll in interface java.util.Collection<T>public boolean containsAll(java.util.Collection<?> c)
containsAll in interface java.util.Collection<T>public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<T>public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<T>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<T>public void clear()
clear in interface java.util.Collection<T>public int hashCode()
hashCode in interface java.util.Collection<T>hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object