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>, org.infinispan.commons.util.CloseableIteratorCollection<E>, org.infinispan.commons.util.CloseableIteratorSet<E>

public abstract class InternalCacheSet<E> extends Object implements CacheSet<E>
Base class for internal classes used in cache collections.

It extends CacheSet because that's what interceptors used return for KeySetCommand and EntrySetCommand, but because these classes are only used internally, we can avoid implementing most of the methods.

Subclasses only need to implement localPublisher(IntSet) and localPublisher(int), and a facade class like CacheBackedKeySet implements the rest of the CacheSet methods.

Since:
14.0
Author:
Dan Berindei
  • Constructor Details

    • InternalCacheSet

      public InternalCacheSet()
  • Method Details

    • localPublisher

      public abstract org.reactivestreams.Publisher<E> localPublisher(int segment)
      Description copied from interface: CacheCollection
      Returns 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:
      localPublisher in interface CacheCollection<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(org.infinispan.commons.util.IntSet segments)
      Description copied from interface: CacheCollection
      Returns 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:
      localPublisher in interface CacheCollection<E>
      Parameters:
      segments - the segments that all published elements belong to
      Returns:
      Publisher that will publish the elements for the given segments
    • removeIf

      public final boolean removeIf(Predicate<? super E> filter)
      Specified by:
      removeIf in interface Collection<E>
    • forEach

      public final void forEach(Consumer<? super E> action)
      Specified by:
      forEach in interface Iterable<E>
    • iterator

      public final org.infinispan.commons.util.CloseableIterator<E> iterator()
      Specified by:
      iterator in interface org.infinispan.commons.util.CloseableIteratorCollection<E>
      Specified by:
      iterator in interface Collection<E>
      Specified by:
      iterator in interface Iterable<E>
      Specified by:
      iterator in interface Set<E>
    • spliterator

      public final org.infinispan.commons.util.CloseableSpliterator<E> spliterator()
      Specified by:
      spliterator in interface org.infinispan.commons.util.CloseableIteratorCollection<E>
      Specified by:
      spliterator in interface org.infinispan.commons.util.CloseableIteratorSet<E>
      Specified by:
      spliterator in interface Collection<E>
      Specified by:
      spliterator in interface Iterable<E>
      Specified by:
      spliterator in interface Set<E>
    • stream

      public final CacheStream<E> stream()
      Specified by:
      stream in interface CacheCollection<E>
      Specified by:
      stream in interface org.infinispan.commons.util.CloseableIteratorCollection<E>
      Specified by:
      stream in interface Collection<E>
    • parallelStream

      public final CacheStream<E> parallelStream()
      Specified by:
      parallelStream in interface CacheCollection<E>
      Specified by:
      parallelStream in interface org.infinispan.commons.util.CloseableIteratorCollection<E>
      Specified by:
      parallelStream in interface Collection<E>
    • size

      public final int size()
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface Set<E>
    • isEmpty

      public final boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<E>
      Specified by:
      isEmpty in interface Set<E>
    • contains

      public final boolean contains(Object o)
      Specified by:
      contains in interface Collection<E>
      Specified by:
      contains in interface Set<E>
    • toArray

      public final Object[] toArray()
      Specified by:
      toArray in interface Collection<E>
      Specified by:
      toArray in interface Set<E>
    • toArray

      public final <T> T[] toArray(T[] a)
      Specified by:
      toArray in interface Collection<E>
      Specified by:
      toArray in interface Set<E>
    • add

      public final boolean add(E e)
      Specified by:
      add in interface Collection<E>
      Specified by:
      add in interface Set<E>
    • remove

      public final boolean remove(Object o)
      Specified by:
      remove in interface Collection<E>
      Specified by:
      remove in interface Set<E>
    • containsAll

      public final boolean containsAll(Collection<?> c)
      Specified by:
      containsAll in interface Collection<E>
      Specified by:
      containsAll in interface Set<E>
    • addAll

      public final boolean addAll(Collection<? extends E> c)
      Specified by:
      addAll in interface Collection<E>
      Specified by:
      addAll in interface Set<E>
    • removeAll

      public final boolean removeAll(Collection<?> c)
      Specified by:
      removeAll in interface Collection<E>
      Specified by:
      removeAll in interface Set<E>
    • retainAll

      public final boolean retainAll(Collection<?> c)
      Specified by:
      retainAll in interface Collection<E>
      Specified by:
      retainAll in interface Set<E>
    • clear

      public final void clear()
      Specified by:
      clear in interface Collection<E>
      Specified by:
      clear in interface Set<E>