public class ReadOnlySegmentAwareCollection<E> extends AbstractDelegatingCollection<E>
This set is useful when you don't want to copy an entire set but only need to see values from the given segments.
Note many operations are not constant time when using this set. Please check the method you are using to see if it will perform differently than normally expected.
| Modifier and Type | Field and Description |
|---|---|
protected IntSet |
allowedSegments |
protected Collection<E> |
set |
protected LocalizedCacheTopology |
topology |
| Constructor and Description |
|---|
ReadOnlySegmentAwareCollection(Collection<E> set,
LocalizedCacheTopology topology,
IntSet allowedSegments) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
protected Collection<E> |
delegate() |
boolean |
isEmpty()
Checks if the provided set is empty.
|
Iterator<E> |
iterator() |
int |
size()
Returns the size of the read only set.
|
protected boolean |
valueAllowed(Object obj) |
add, addAll, clear, forEach, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArrayclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals, hashCodeprotected final Collection<E> set
protected final LocalizedCacheTopology topology
protected final IntSet allowedSegments
public ReadOnlySegmentAwareCollection(Collection<E> set, LocalizedCacheTopology topology, IntSet allowedSegments)
protected Collection<E> delegate()
delegate in class AbstractDelegatingCollection<E>protected boolean valueAllowed(Object obj)
public boolean contains(Object o)
contains in interface Collection<E>contains in class AbstractDelegatingCollection<E>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in class AbstractDelegatingCollection<E>public boolean isEmpty()
This method should always be preferred over checking the size to see if it is empty.
This time complexity for this method between O(1) to O(N).
isEmpty in interface Collection<E>isEmpty in class AbstractDelegatingCollection<E>public int size()
If you are using this method to verify if the set is empty, you should instead use
the isEmpty() as it will perform better if the
size is only used for this purpose.
This time complexity for this method is always O(N).
size in interface Collection<E>size in class AbstractDelegatingCollection<E>Copyright © 2021 JBoss by Red Hat. All rights reserved.