public class IntSet
extends java.lang.Object
implements org.apache.commons.collections.primitives.IntCollection
Constructor and Description |
---|
IntSet()
Constructs a new, empty set; the backing HashMap instance has default
initial capacity (16) and load factor (0.75).
|
IntSet(int initialCapacity)
Constructs a new, empty set; the backing HashMap instance has the
specified initial capacity and default load factor, which is 0.75.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(int id)
Adds the specified element to this set if it is not already present.
|
boolean |
addAll(org.apache.commons.collections.primitives.IntCollection c) |
void |
clear()
Removes all of the elements from this set.
|
boolean |
contains(int id)
Returns true if this set contains the specified element.
|
boolean |
containsAll(org.apache.commons.collections.primitives.IntCollection c) |
boolean |
isEmpty()
Returns true if this set contains no elements.
|
org.apache.commons.collections.primitives.IntIterator |
iterator() |
org.apache.commons.collections.primitives.IntListIterator |
listIterator() |
boolean |
remove(int id)
Removes the specified element from this set if it is present.
|
boolean |
removeAll(org.apache.commons.collections.primitives.IntCollection c) |
boolean |
removeElement(int element) |
boolean |
retainAll(org.apache.commons.collections.primitives.IntCollection c) |
int |
size()
Returns the number of elements in this set (its cardinality).
|
int[] |
toArray() |
int[] |
toArray(int[] a) |
public IntSet()
public IntSet(int initialCapacity)
initialCapacity
- the initial capacity of the hash table.java.lang.IllegalArgumentException
- if the initial capacity is less than zero.public boolean add(int id)
add
in interface org.apache.commons.collections.primitives.IntCollection
id
- element to be added to this set.public void clear()
clear
in interface org.apache.commons.collections.primitives.IntCollection
public boolean contains(int id)
contains
in interface org.apache.commons.collections.primitives.IntCollection
id
- element whose presence in this set is to be tested.public boolean isEmpty()
isEmpty
in interface org.apache.commons.collections.primitives.IntCollection
public org.apache.commons.collections.primitives.IntIterator iterator()
iterator
in interface org.apache.commons.collections.primitives.IntCollection
public org.apache.commons.collections.primitives.IntListIterator listIterator()
public boolean remove(int id)
id
- object to be removed from this set, if present.public int size()
size
in interface org.apache.commons.collections.primitives.IntCollection
public boolean addAll(org.apache.commons.collections.primitives.IntCollection c)
addAll
in interface org.apache.commons.collections.primitives.IntCollection
public boolean containsAll(org.apache.commons.collections.primitives.IntCollection c)
containsAll
in interface org.apache.commons.collections.primitives.IntCollection
public boolean removeAll(org.apache.commons.collections.primitives.IntCollection c)
removeAll
in interface org.apache.commons.collections.primitives.IntCollection
public boolean removeElement(int element)
removeElement
in interface org.apache.commons.collections.primitives.IntCollection
public boolean retainAll(org.apache.commons.collections.primitives.IntCollection c)
retainAll
in interface org.apache.commons.collections.primitives.IntCollection
public int[] toArray()
toArray
in interface org.apache.commons.collections.primitives.IntCollection
public int[] toArray(int[] a)
toArray
in interface org.apache.commons.collections.primitives.IntCollection