E
- the original collection type - referred to as old in some methodsR
- the resulting collection type - referred to as new in some methodspublic class WriteableCacheCollectionMapper<E,R> extends CollectionMapper<E,R> implements CacheCollection<R>
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.
Modifier and Type | Field and Description |
---|---|
protected Function<? super R,? extends E> |
fromNewTypeFunction |
protected InjectiveFunction<Object,?> |
keyFilterMapper |
protected CacheCollection<E> |
realCacheCollection |
protected Function<? super E,? extends R> |
toNewTypeIteratorFunction |
mapper, realCollection
Constructor and Description |
---|
WriteableCacheCollectionMapper(CacheCollection<E> realCollection,
Function<? super E,? extends R> toNewTypeFunction,
Function<? super E,? extends R> toNewTypeIteratorFunction,
Function<? super R,? extends E> fromNewTypeFunction,
InjectiveFunction<Object,?> keyFilterFunction) |
WriteableCacheCollectionMapper(CacheCollection<E> realCollection,
Function<? super E,? extends R> toNewTypeFunction,
Function<? super R,? extends E> fromNewTypeFunction,
InjectiveFunction<Object,?> keyFilterFunction) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(R e) |
boolean |
addAll(Collection<? extends R> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
CloseableIterator<R> |
iterator() |
CacheStream<R> |
parallelStream() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
removeIf(Predicate<? super R> filter) |
boolean |
retainAll(Collection<?> c) |
CloseableSpliterator<R> |
spliterator() |
CacheStream<R> |
stream() |
forEach, isEmpty, size
toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
localPublisher, localPublisher
protected final CacheCollection<E> realCacheCollection
protected final InjectiveFunction<Object,?> keyFilterMapper
public WriteableCacheCollectionMapper(CacheCollection<E> realCollection, Function<? super E,? extends R> toNewTypeFunction, Function<? super R,? extends E> fromNewTypeFunction, InjectiveFunction<Object,?> keyFilterFunction)
public WriteableCacheCollectionMapper(CacheCollection<E> realCollection, Function<? super E,? extends R> toNewTypeFunction, Function<? super E,? extends R> toNewTypeIteratorFunction, Function<? super R,? extends E> fromNewTypeFunction, InjectiveFunction<Object,?> keyFilterFunction)
public CloseableIterator<R> iterator()
CloseableIteratorCollection
This iterator should be explicitly closed when iteration upon it is completed. Failure to do so could cause resources to not be freed properly
iterator
in interface Iterable<R>
iterator
in interface Collection<R>
iterator
in interface CloseableIteratorCollection<R>
iterator
in class CollectionMapper<E,R>
public boolean contains(Object o)
contains
in interface Collection<R>
contains
in class AbstractCollection<R>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<R>
containsAll
in class AbstractCollection<R>
public boolean add(R e)
add
in interface Collection<R>
add
in class CollectionMapper<E,R>
public boolean addAll(Collection<? extends R> c)
addAll
in interface Collection<R>
addAll
in class CollectionMapper<E,R>
public boolean remove(Object o)
remove
in interface Collection<R>
remove
in class CollectionMapper<E,R>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<R>
removeAll
in class CollectionMapper<E,R>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<R>
retainAll
in class CollectionMapper<E,R>
public boolean removeIf(Predicate<? super R> filter)
removeIf
in interface Collection<R>
public void clear()
clear
in interface Collection<R>
clear
in class CollectionMapper<E,R>
public CloseableSpliterator<R> spliterator()
CloseableIteratorCollection
This spliterator should be explicitly closed after it has been used. Failure to do so could cause resources to not be freed properly
spliterator
in interface Iterable<R>
spliterator
in interface Collection<R>
spliterator
in interface CloseableIteratorCollection<R>
spliterator
in class CollectionMapper<E,R>
public CacheStream<R> stream()
CloseableIteratorCollection
This stream should be explicitly closed after it has been used. Failure to do so could cause resources to not be freed properly
stream
in interface Collection<R>
stream
in interface CacheCollection<R>
stream
in interface CloseableIteratorCollection<R>
stream
in class CollectionMapper<E,R>
public CacheStream<R> parallelStream()
CloseableIteratorCollection
This stream should be explicitly closed after it has been used. Failure to do so could cause resources to not be freed properly
parallelStream
in interface Collection<R>
parallelStream
in interface CacheCollection<R>
parallelStream
in interface CloseableIteratorCollection<R>
parallelStream
in class CollectionMapper<E,R>
Copyright © 2021 JBoss by Red Hat. All rights reserved.