public class PartitionIdSet extends AbstractSet<Integer>
BitSet whose value at a particular
index is set when that partition ID is present in the set. This offers better
performance than a general purpose Set<Integer> implementation and better
memory efficiency in most cases.
Additionally, the PartitionIdSet supplies specialized methods for add,
remove and contains of primitive int arguments, as well as a
primitive int iterator implementation, to allow clients avoid cost of boxing
and unboxing.
This set's iterator is a view of the actual
set, so any changes on the set will be reflected in the iterator and vice versa.
This class is not thread-safe.
| Constructor and Description |
|---|
PartitionIdSet(int partitionCount) |
PartitionIdSet(int partitionCount,
Collection<Integer> initialPartitionIds) |
PartitionIdSet(PartitionIdSet initialPartitionIds) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int partitionId) |
boolean |
add(Integer partitionId) |
void |
addAll(PartitionIdSet other) |
void |
clear() |
void |
complement()
Mutates this set so it contains its complement with respect to the universe of all partition IDs.
|
boolean |
contains(int partitionId) |
boolean |
contains(Object o) |
boolean |
containsAll(PartitionIdSet other) |
int |
getPartitionCount() |
boolean |
intersects(PartitionIdSet other)
Returns whether the intersection of this set with given argument is not empty.
|
PrimitiveIterator.OfInt |
intIterator() |
boolean |
isEmpty() |
boolean |
isMissingPartitions() |
Iterator<Integer> |
iterator() |
boolean |
remove(int partitionId) |
boolean |
remove(Object o) |
void |
removeAll(PartitionIdSet other) |
int |
size() |
void |
union(PartitionIdSet other)
Mutates this
PartitionIdSet so it contains the union of this and other's
partition IDs. |
equals, hashCode, removeAlladdAll, containsAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, containsAll, retainAll, spliterator, toArray, toArrayparallelStream, removeIf, streampublic PartitionIdSet(int partitionCount)
public PartitionIdSet(int partitionCount,
Collection<Integer> initialPartitionIds)
public PartitionIdSet(PartitionIdSet initialPartitionIds)
public PrimitiveIterator.OfInt intIterator()
public int size()
size in interface Collection<Integer>size in interface Set<Integer>size in class AbstractCollection<Integer>public boolean isEmpty()
isEmpty in interface Collection<Integer>isEmpty in interface Set<Integer>isEmpty in class AbstractCollection<Integer>public boolean contains(Object o)
contains in interface Collection<Integer>contains in interface Set<Integer>contains in class AbstractCollection<Integer>public boolean contains(int partitionId)
public boolean containsAll(PartitionIdSet other)
true when this set contains all partition IDs contained in otherpublic boolean add(Integer partitionId)
add in interface Collection<Integer>add in interface Set<Integer>add in class AbstractCollection<Integer>public boolean add(int partitionId)
public void addAll(PartitionIdSet other)
public boolean remove(Object o)
remove in interface Collection<Integer>remove in interface Set<Integer>remove in class AbstractCollection<Integer>public boolean remove(int partitionId)
public void removeAll(PartitionIdSet other)
public void clear()
clear in interface Collection<Integer>clear in interface Set<Integer>clear in class AbstractCollection<Integer>public int getPartitionCount()
public boolean intersects(PartitionIdSet other)
true when the intersection of this and other set
is not empty, otherwise false.public void union(PartitionIdSet other)
PartitionIdSet so it contains the union of this and other's
partition IDs.public void complement()
public boolean isMissingPartitions()
false when all partition IDs in [0, partitionCount) are contained in this
set, otherwise trueCopyright © 2019 Hazelcast, Inc.. All rights reserved.