Package org.infinispan.util
Class WriteableCacheCollectionMapper<E,R>
java.lang.Object
java.util.AbstractCollection<R>
org.infinispan.util.CollectionMapper<E,R>
org.infinispan.util.WriteableCacheCollectionMapper<E,R>
- Type Parameters:
E
- the original collection type - referred to as old in some methodsR
- the resulting collection type - referred to as new in some methods
- All Implemented Interfaces:
Iterable<R>
,Collection<R>
,CacheCollection<R>
,org.infinispan.commons.util.CloseableIteratorCollection<R>
- Direct Known Subclasses:
WriteableCacheSetMapper
public class WriteableCacheCollectionMapper<E,R>
extends CollectionMapper<E,R>
implements CacheCollection<R>
A writeable cache collection mapper that also has constant time operations for things such as
Collection.contains(Object)
if the underlying Collection does.
This collection should be used for cases when a simple transformation of a element to another is all that is needed by the underlying collection.
Note this class allows for a different function specifically for values returned from an iterator. This
can be useful to intercept calls such as Map.Entry.setValue(Object)
and update appropriately.
- Since:
- 9.2
- Author:
- wburns
-
Field Summary
Modifier and TypeFieldDescriptionprotected final org.infinispan.commons.util.InjectiveFunction
<Object, ?> protected final CacheCollection
<E> Fields inherited from class org.infinispan.util.CollectionMapper
mapper, realCollection
-
Constructor Summary
ConstructorDescriptionWriteableCacheCollectionMapper
(CacheCollection<E> realCollection, Function<? super E, ? extends R> toNewTypeFunction, Function<? super E, ? extends R> toNewTypeIteratorFunction, Function<? super R, ? extends E> fromNewTypeFunction, org.infinispan.commons.util.InjectiveFunction<Object, ?> keyFilterFunction) WriteableCacheCollectionMapper
(CacheCollection<E> realCollection, Function<? super E, ? extends R> toNewTypeFunction, Function<? super R, ? extends E> fromNewTypeFunction, org.infinispan.commons.util.InjectiveFunction<Object, ?> keyFilterFunction) -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends R> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) org.infinispan.commons.util.CloseableIterator
<R> iterator()
boolean
boolean
removeAll
(Collection<?> c) boolean
boolean
retainAll
(Collection<?> c) org.infinispan.commons.util.CloseableSpliterator
<R> stream()
Methods inherited from class org.infinispan.util.CollectionMapper
forEach, isEmpty, size
Methods inherited from class java.util.AbstractCollection
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
-
Field Details
-
realCacheCollection
-
toNewTypeIteratorFunction
-
fromNewTypeFunction
-
keyFilterMapper
-
-
Constructor Details
-
WriteableCacheCollectionMapper
-
WriteableCacheCollectionMapper
public WriteableCacheCollectionMapper(CacheCollection<E> realCollection, Function<? super E, ? extends R> toNewTypeFunction, Function<? super E, ? extends R> toNewTypeIteratorFunction, Function<? super R, ? extends E> fromNewTypeFunction, org.infinispan.commons.util.InjectiveFunction<Object, ?> keyFilterFunction)
-
-
Method Details
-
iterator
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Overrides:
contains
in classAbstractCollection<R>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
- Overrides:
containsAll
in classAbstractCollection<R>
-
add
- Specified by:
add
in interfaceCollection<E>
- Overrides:
add
in classCollectionMapper<E,
R>
-
addAll
- Specified by:
addAll
in interfaceCollection<E>
- Overrides:
addAll
in classCollectionMapper<E,
R>
-
remove
- Specified by:
remove
in interfaceCollection<E>
- Overrides:
remove
in classCollectionMapper<E,
R>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<E>
- Overrides:
removeAll
in classCollectionMapper<E,
R>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<E>
- Overrides:
retainAll
in classCollectionMapper<E,
R>
-
removeIf
- Specified by:
removeIf
in interfaceCollection<E>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
- Overrides:
clear
in classCollectionMapper<E,
R>
-
spliterator
- Specified by:
spliterator
in interfaceorg.infinispan.commons.util.CloseableIteratorCollection<E>
- Specified by:
spliterator
in interfaceCollection<E>
- Specified by:
spliterator
in interfaceIterable<E>
- Overrides:
spliterator
in classCollectionMapper<E,
R>
-
stream
- Specified by:
stream
in interfaceCacheCollection<E>
- Specified by:
stream
in interfaceorg.infinispan.commons.util.CloseableIteratorCollection<E>
- Specified by:
stream
in interfaceCollection<E>
- Overrides:
stream
in classCollectionMapper<E,
R>
-
parallelStream
- Specified by:
parallelStream
in interfaceCacheCollection<E>
- Specified by:
parallelStream
in interfaceorg.infinispan.commons.util.CloseableIteratorCollection<E>
- Specified by:
parallelStream
in interfaceCollection<E>
- Overrides:
parallelStream
in classCollectionMapper<E,
R>
-