Package org.infinispan.util
Class CacheSetMapper<E,R>
- java.lang.Object
-
- java.util.AbstractCollection<R>
-
- org.infinispan.util.CollectionMapper<E,R>
-
- org.infinispan.util.SetMapper<E,R>
-
- org.infinispan.util.CacheSetMapper<E,R>
-
- All Implemented Interfaces:
java.lang.Iterable<R>,java.util.Collection<R>,java.util.Set<R>,CacheCollection<R>,CacheSet<R>,CloseableIteratorCollection<R>,CloseableIteratorSet<R>
public class CacheSetMapper<E,R> extends SetMapper<E,R> implements CacheSet<R>
ACacheSetthat 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 Summary
Fields Modifier and Type Field Description protected CacheSet<E>realSet-
Fields inherited from class org.infinispan.util.CollectionMapper
mapper, realCollection
-
-
Constructor Summary
Constructors Constructor Description CacheSetMapper(CacheSet<E> realSet, java.util.function.Function<? super E,? extends R> mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CloseableIterator<R>iterator()CacheStream<R>parallelStream()CloseableSpliterator<R>spliterator()CacheStream<R>stream()-
Methods inherited from class org.infinispan.util.CollectionMapper
add, addAll, clear, forEach, isEmpty, remove, removeAll, retainAll, size
-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.infinispan.CacheCollection
localPublisher, localPublisher
-
-
-
-
Method Detail
-
stream
public CacheStream<R> 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>- Specified by:
streamin interfacejava.util.Collection<E>- Overrides:
streamin classCollectionMapper<E,R>
-
parallelStream
public CacheStream<R> 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>- Specified by:
parallelStreamin interfacejava.util.Collection<E>- Overrides:
parallelStreamin classCollectionMapper<E,R>
-
spliterator
public CloseableSpliterator<R> 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>- Specified by:
spliteratorin interfacejava.util.Collection<E>- Specified by:
spliteratorin interfacejava.lang.Iterable<E>- Specified by:
spliteratorin interfacejava.util.Set<E>- Overrides:
spliteratorin classCollectionMapper<E,R>
-
iterator
public CloseableIterator<R> 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>- Specified by:
iteratorin interfacejava.util.Collection<E>- Specified by:
iteratorin interfacejava.lang.Iterable<E>- Specified by:
iteratorin interfacejava.util.Set<E>- Overrides:
iteratorin classCollectionMapper<E,R>
-
-