Class CacheSetMapper<E,​R>

  • All Implemented Interfaces:
    Iterable<R>, Collection<R>, Set<R>, CacheCollection<R>, CacheSet<R>, org.infinispan.commons.util.CloseableIteratorCollection<R>, org.infinispan.commons.util.CloseableIteratorSet<R>

    public class CacheSetMapper<E,​R>
    extends SetMapper<E,​R>
    implements CacheSet<R>
    A CacheSet that allows for a different set to be mapped as a different instance wtih values replaced on request. This is useful as a cache set is normally lazily evaluated to prevent having to pull all values into memory which can be a lot faster when checking single values and can also prevent out of memory issues.
    Since:
    9.0
    Author:
    wburns
    • Field Detail

      • realSet

        protected final CacheSet<E> realSet
    • Constructor Detail

      • CacheSetMapper

        public CacheSetMapper​(CacheSet<E> realSet,
                              Function<? super E,​? extends R> mapper)
    • Method Detail

      • stream

        public CacheStream<R> stream()
        Description copied from interface: org.infinispan.commons.util.CloseableIteratorCollection

        This stream should be explicitly closed after it has been used. Failure to do so could cause resources to not be freed properly

        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>
        Overrides:
        stream in class CollectionMapper<E,​R>
      • parallelStream

        public CacheStream<R> parallelStream()
        Description copied from interface: org.infinispan.commons.util.CloseableIteratorCollection

        This stream should be explicitly closed after it has been used. Failure to do so could cause resources to not be freed properly

        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>
        Overrides:
        parallelStream in class CollectionMapper<E,​R>
      • spliterator

        public org.infinispan.commons.util.CloseableSpliterator<R> spliterator()
        Description copied from interface: org.infinispan.commons.util.CloseableIteratorCollection

        This spliterator should be explicitly closed after it has been used. Failure to do so could cause resources to not be freed properly

        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>
        Overrides:
        spliterator in class CollectionMapper<E,​R>
      • iterator

        public org.infinispan.commons.util.CloseableIterator<R> iterator()
        Description copied from interface: org.infinispan.commons.util.CloseableIteratorCollection

        This 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:
        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>
        Overrides:
        iterator in class CollectionMapper<E,​R>