Class CacheCollectionMapper<E,​R>

  • Type Parameters:
    E - Type of elements in collection before transformation
    R - Type of elements in collection after transformation
    All Implemented Interfaces:
    Iterable<R>, Collection<R>, CacheCollection<R>, org.infinispan.commons.util.CloseableIteratorCollection<R>

    @Deprecated
    public class CacheCollectionMapper<E,​R>
    extends CollectionMapper<E,​R>
    implements CacheCollection<R>
    Deprecated.
    since 9.2.1 It is recommended to use WriteableCacheCollectionMapper instead as it allows for constant time contains and other operations
    A CacheCollection that allows for a different set to be mapped as a different instance with values replaced on request. This is useful as a cache collection that 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.

    Some operations such as Collection.contains(Object) and Collection.containsAll(Collection) may be more expensive then normal since they cannot utilize lookups into the original collection.

    Since:
    9.0
    • Field Detail

      • realCacheCollection

        protected final CacheCollection<E> realCacheCollection
        Deprecated.
      • keyFilterMapper

        protected final org.infinispan.commons.util.InjectiveFunction<Object,​?> keyFilterMapper
        Deprecated.
    • Constructor Detail

      • CacheCollectionMapper

        public CacheCollectionMapper​(CacheCollection<E> realCollection,
                                     Function<? super E,​? extends R> mapper)
        Deprecated.
        CacheCollection that maps entries to new type that takes a key filter that is Function.identity()
        Parameters:
        realCollection - the collection storing original entries
        mapper - the mapper to the new type
      • CacheCollectionMapper

        public CacheCollectionMapper​(CacheCollection<E> realCollection,
                                     Function<? super E,​? extends R> mapper,
                                     org.infinispan.commons.util.InjectiveFunction<Object,​?> keyFilterMapper)
        Deprecated.
        CacheCollection that maps entries to new type that takes a provided key filter.
        Parameters:
        realCollection - the collection storing original entries
        mapper - the mapper to the new type
        keyFilterMapper - the key filter mapper to use (since collection may not be the same type)
    • Method Detail

      • spliterator

        public org.infinispan.commons.util.CloseableSpliterator<R> spliterator()
        Deprecated.
        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 Collection<E>
        Specified by:
        spliterator in interface Iterable<E>
        Overrides:
        spliterator in class CollectionMapper<E,​R>
      • iterator

        public org.infinispan.commons.util.CloseableIterator<R> iterator()
        Deprecated.
        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>
        Overrides:
        iterator in class CollectionMapper<E,​R>
      • stream

        public CacheStream<R> stream()
        Deprecated.
        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()
        Deprecated.
        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>