Class InternalCacheSet<E>
- java.lang.Object
-
- org.infinispan.InternalCacheSet<E>
-
- Type Parameters:
E- The element type
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Set<E>,CacheCollection<E>,CacheSet<E>,CloseableIteratorCollection<E>,CloseableIteratorSet<E>
public abstract class InternalCacheSet<E> extends Object implements CacheSet<E>
Base class for internal classes used in cache collections.It extends
CacheSetbecause that's what interceptors used return forKeySetCommandandEntrySetCommand, but because these classes are only used internally, we can avoid implementing most of the methods.Subclasses only need to implement
localPublisher(IntSet)andlocalPublisher(int), and a facade class likeCacheBackedKeySetimplements the rest of theCacheSetmethods.- Since:
- 14.0
- Author:
- Dan Berindei
-
-
Constructor Summary
Constructors Constructor Description InternalCacheSet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanadd(E e)booleanaddAll(Collection<? extends E> c)voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)voidforEach(Consumer<? super E> action)booleanisEmpty()CloseableIterator<E>iterator()abstract org.reactivestreams.Publisher<E>localPublisher(int segment)Returns a publisher that will publish all elements that map to the given segment.abstract org.reactivestreams.Publisher<E>localPublisher(IntSet segments)Returns a publisher that will publish all elements that map to the given segment.CacheStream<E>parallelStream()booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanremoveIf(Predicate<? super E> filter)booleanretainAll(Collection<?> c)intsize()CloseableSpliterator<E>spliterator()CacheStream<E>stream()Object[]toArray()<T> T[]toArray(T[] a)
-
-
-
Method Detail
-
localPublisher
public abstract org.reactivestreams.Publisher<E> localPublisher(int segment)
Description copied from interface:CacheCollectionReturns a publisher that will publish all elements that map to the given segment. Note this publisher may require going remotely to retrieve elements depending on the underlying configuration and flags applied to the original Cache used to create this CacheCollection.- Specified by:
localPublisherin interfaceCacheCollection<E>- Parameters:
segment- the segment that all published elements belong to- Returns:
- Publisher that will publish the elements for the given segment
-
localPublisher
public abstract org.reactivestreams.Publisher<E> localPublisher(IntSet segments)
Description copied from interface:CacheCollectionReturns a publisher that will publish all elements that map to the given segment. Note this publisher may require going remotely to retrieve elements depending on the underlying configuration and flags applied to the original Cache used to create this CacheCollection.- Specified by:
localPublisherin interfaceCacheCollection<E>- Parameters:
segments- the segments that all published elements belong to- Returns:
- Publisher that will publish the elements for the given segments
-
iterator
public final CloseableIterator<E> iterator()
Description copied from interface:CloseableIteratorCollectionThis iterator should be explicitly closed when iteration upon it is completed. Failure to do so could cause resources to not be freed properly
- Specified by:
iteratorin interfaceCloseableIteratorCollection<E>
-
spliterator
public final CloseableSpliterator<E> spliterator()
Description copied from interface:CloseableIteratorCollectionThis spliterator should be explicitly closed after it has been used. Failure to do so could cause resources to not be freed properly
- Specified by:
spliteratorin interfaceCloseableIteratorCollection<E>- Specified by:
spliteratorin interfaceCloseableIteratorSet<E>
-
stream
public final CacheStream<E> stream()
Description copied from interface:CloseableIteratorCollectionThis stream should be explicitly closed after it has been used. Failure to do so could cause resources to not be freed properly
- Specified by:
streamin interfaceCacheCollection<E>- Specified by:
streamin interfaceCloseableIteratorCollection<E>
-
parallelStream
public final CacheStream<E> parallelStream()
Description copied from interface:CloseableIteratorCollectionThis stream should be explicitly closed after it has been used. Failure to do so could cause resources to not be freed properly
- Specified by:
parallelStreamin interfaceCacheCollection<E>- Specified by:
parallelStreamin interfaceCloseableIteratorCollection<E>
-
size
public final int size()
-
isEmpty
public final boolean isEmpty()
-
contains
public final boolean contains(Object o)
-
toArray
public final Object[] toArray()
-
toArray
public final <T> T[] toArray(T[] a)
-
add
public final boolean add(E e)
-
remove
public final boolean remove(Object o)
-
containsAll
public final boolean containsAll(Collection<?> c)
-
addAll
public final boolean addAll(Collection<? extends E> c)
-
removeAll
public final boolean removeAll(Collection<?> c)
-
retainAll
public final boolean retainAll(Collection<?> c)
-
clear
public final void clear()
-
-