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:
    java.lang.Iterable<R>, java.util.Collection<R>, CacheCollection<R>, 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 InjectiveFunction<java.lang.Object,​?> keyFilterMapper
        Deprecated.
    • Constructor Detail

      • CacheCollectionMapper

        public CacheCollectionMapper​(CacheCollection<E> realCollection,
                                     java.util.function.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,
                                     java.util.function.Function<? super E,​? extends R> mapper,
                                     InjectiveFunction<java.lang.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)