Package org.apache.sis.util.collection
Class CacheEntries<K,V>
- Type Parameters:
K
- the type of key objects.V
- the type of value objects.
- All Implemented Interfaces:
Iterable<Map.Entry<K,
,V>> Collection<Map.Entry<K,
,V>> Set<Map.Entry<K,
V>>
The set of entries in the
Cache.map
. On iteration, handlers will be skipped
and the values of weak references are returned instead of the Reference
object.
This class is not needed for the normal working of Cache
. it is used only if
the user wants to see the cache entries through the standard Java collection API.
Thread safety
This class is thread-safe if and only if theSet
given to the constructor is thread-safe.- Since:
- 0.3
- Version:
- 0.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
An iterator over the entries in theCache.map
. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, remove, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
entries
The set of entries in theCache.map
.
-
-
Constructor Details
-
CacheEntries
Wraps the given set of entries of aCache.map
.- Parameters:
entries
- the set of entries. Implementation shall support concurrency.
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returnstrue
if the set is empty. Overloaded becauseConcurrentHashMap
has a more efficient implementation of this method than testingsize() == 0
. -
size
public int size()Returns the number of entries. -
iterator
Returns an iterator over the entries.
-