Class CachedCollection<T>
java.lang.Object
com.comphenix.protocol.wrappers.collection.CachedCollection<T>
- Type Parameters:
T- - type of each element in the collection.
- All Implemented Interfaces:
Iterable<T>,Collection<T>
- Direct Known Subclasses:
CachedSet
Represents a set that will (best effort) cache elements before using
an underlying set to retrieve the actual element.
The cache will be invalidated when data is removed.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCachedCollection(Set<T> delegate) Construct a cached collection with the given delegate. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends T> c) voidclear()booleanbooleancontainsAll(Collection<?> c) inthashCode()booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()Object[]toArray()<T> T[]toArray(T[] a) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
equals, parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
delegate
-
cache
-
-
Constructor Details
-
CachedCollection
Construct a cached collection with the given delegate.Objects are cached before they can be extracted from this collection.
- Parameters:
delegate- - the delegate.
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceCollection<T>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<T>
-
contains
- Specified by:
containsin interfaceCollection<T>
-
iterator
-
toArray
- Specified by:
toArrayin interfaceCollection<T>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArrayin interfaceCollection<T>
-
add
- Specified by:
addin interfaceCollection<T>
-
addAll
- Specified by:
addAllin interfaceCollection<T>
-
containsAll
- Specified by:
containsAllin interfaceCollection<T>
-
remove
- Specified by:
removein interfaceCollection<T>
-
removeAll
- Specified by:
removeAllin interfaceCollection<T>
-
retainAll
- Specified by:
retainAllin interfaceCollection<T>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<T>
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<T>- Overrides:
hashCodein classObject
-
toString
-