Package org.infinispan.util
Class CollectionMapper<E,R>
- java.lang.Object
-
- java.util.AbstractCollection<R>
-
- org.infinispan.util.CollectionMapper<E,R>
-
- All Implemented Interfaces:
Iterable<R>,Collection<R>
- Direct Known Subclasses:
CacheCollectionMapper,SetMapper,WriteableCacheCollectionMapper
public class CollectionMapper<E,R> extends AbstractCollection<R>
A collection that maps another one to a new one of a possibly different type. Note this collection is read only and doesn't accept write operations.Some operations such as
Collection.contains(Object)andCollection.containsAll(Collection)may be more expensive then normal since they cannot utilize lookups into the original collection.- Since:
- 9.0
- Author:
- wburns
-
-
Field Summary
Fields Modifier and Type Field Description protected Function<? super E,? extends R>mapperprotected Collection<E>realCollection
-
Constructor Summary
Constructors Constructor Description CollectionMapper(Collection<E> realCollection, Function<? super E,? extends R> mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(R e)booleanaddAll(Collection<? extends R> c)voidclear()voidforEach(Consumer<? super R> action)booleanisEmpty()Iterator<R>iterator()Stream<R>parallelStream()booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanretainAll(Collection<?> c)intsize()Spliterator<R>spliterator()Stream<R>stream()-
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 java.util.Collection
equals, hashCode, removeIf, toArray
-
-
-
-
Field Detail
-
realCollection
protected final Collection<E> realCollection
-
-
Constructor Detail
-
CollectionMapper
public CollectionMapper(Collection<E> realCollection, Function<? super E,? extends R> mapper)
-
-
Method Detail
-
size
public int size()
- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein classAbstractCollection<R>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<E>- Overrides:
isEmptyin classAbstractCollection<R>
-
iterator
public Iterator<R> iterator()
- Specified by:
iteratorin interfaceCollection<E>- Specified by:
iteratorin interfaceIterable<E>- Specified by:
iteratorin classAbstractCollection<R>
-
spliterator
public Spliterator<R> spliterator()
-
add
public boolean add(R e)
- Specified by:
addin interfaceCollection<E>- Overrides:
addin classAbstractCollection<R>
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<E>- Overrides:
removein classAbstractCollection<R>
-
addAll
public boolean addAll(Collection<? extends R> c)
- Specified by:
addAllin interfaceCollection<E>- Overrides:
addAllin classAbstractCollection<R>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<E>- Overrides:
removeAllin classAbstractCollection<R>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<E>- Overrides:
retainAllin classAbstractCollection<R>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<E>- Overrides:
clearin classAbstractCollection<R>
-
-