public class IntegerSet extends Object
This class is intentionally missing a size method.
| Constructor and Description |
|---|
IntegerSet(int maximumCount)
Initialize a lookup table with the given maximum number of elements.
|
IntegerSet(int maximumCount,
Collection<Integer> values)
Initialize a lookup table with a given maximum and value list.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int element)
Add the given element to the set, or do nothing if it already exists.
|
void |
addAll(Collection<Integer> packets)
Add the given collection of elements to the set.
|
void |
clear()
Remove every element from the set.
|
boolean |
contains(int element)
Determine whether or not the given element exists in the set.
|
void |
remove(int element)
Remove the given element from the set, or do nothing if it's already removed.
|
Set<Integer> |
toSet()
Convert the current IntegerSet to an equivalent HashSet.
|
public IntegerSet(int maximumCount)
This creates a set for elements in the range [0, count).
Formally, the current set must be a subset of [0, 1, 2, ..., count - 1].
maximumCount - - maximum element value and count.public IntegerSet(int maximumCount,
Collection<Integer> values)
The provided elements must be in the range [0, count).
maximumCount - - the maximum element value and count.values - - the elements to add to the set.public boolean contains(int element)
element - - the element to check. Must be in the range [0, count).public void add(int element)
element - - element to add.ArrayIndexOutOfBoundsException - If the given element is not in the range [0, count).public void addAll(Collection<Integer> packets)
packets - - elements to add.public void remove(int element)
element - - element to remove.public void clear()
Copyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.