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>
mapper
protected 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 boolean
add(R e)
boolean
addAll(Collection<? extends R> c)
void
clear()
void
forEach(Consumer<? super R> action)
boolean
isEmpty()
Iterator<R>
iterator()
Stream<R>
parallelStream()
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
int
size()
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:
size
in interfaceCollection<E>
- Specified by:
size
in classAbstractCollection<R>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<E>
- Overrides:
isEmpty
in classAbstractCollection<R>
-
iterator
public Iterator<R> iterator()
- Specified by:
iterator
in interfaceCollection<E>
- Specified by:
iterator
in interfaceIterable<E>
- Specified by:
iterator
in classAbstractCollection<R>
-
spliterator
public Spliterator<R> spliterator()
-
add
public boolean add(R e)
- Specified by:
add
in interfaceCollection<E>
- Overrides:
add
in classAbstractCollection<R>
-
remove
public boolean remove(Object o)
- Specified by:
remove
in interfaceCollection<E>
- Overrides:
remove
in classAbstractCollection<R>
-
addAll
public boolean addAll(Collection<? extends R> c)
- Specified by:
addAll
in interfaceCollection<E>
- Overrides:
addAll
in classAbstractCollection<R>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<E>
- Overrides:
removeAll
in classAbstractCollection<R>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<E>
- Overrides:
retainAll
in classAbstractCollection<R>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<E>
- Overrides:
clear
in classAbstractCollection<R>
-
-