public abstract class IntSet extends Object
Constructor and Description |
---|
IntSet() |
Modifier and Type | Method and Description |
---|---|
abstract void |
add(int... elements)
Add new elements to this set.
|
abstract void |
add(IntSet set2)
Add to this set any element of another set that is not already in this set.
|
abstract boolean |
contains(int target)
Method to determine if a particular element is in this set.
|
abstract IntSet |
intersection(IntSet set2)
Create a new set that contains all the elements that are in both this set and the other set.
|
abstract void |
keepCommonElements(IntSet set2)
Remove from this set any of its elements that are not contained in another set.
|
abstract IntSet |
minus(IntSet set2)
Create a new set that contains all the elements from this set except those from the other set.
|
abstract boolean |
remove(int target)
Remove a specified element from this set.
|
abstract int |
size()
Determine the number of elements in this set.
|
abstract void |
subtract(IntSet set2)
Remove from this set any element of another set that is in this set.
|
abstract int[] |
toArray()
Create an array represntation of the contents of this set.
|
abstract String |
toString()
Create a String representation of the contents of this set.
|
abstract IntSet |
union(IntSet set2)
Create a new set that contains all the elements from this set and the other set.
|
public abstract void add(int... elements)
elements
- (a variable-arity argument)
one or more new elements that are being insertedOutOfMemoryError
- Indicates insufficient memory for increasing the set's capacity.public abstract void add(IntSet set2)
set2
- a set whose elements will be unioned with this setNullPointerException
- Indicates that set2 is null.OutOfMemoryError
- Indicates insufficient memory to increase the size of this set.public abstract boolean contains(int target)
target
- the element that needs to be found in this setpublic abstract IntSet intersection(IntSet set2)
set2
- the second set in the intersectionNullPointerException
- Indicates that the argument is null.OutOfMemoryError
- Indicates insufficient memory for the new set.public abstract void keepCommonElements(IntSet set2)
set2
- a set whose elements will be intersected with this setNullPointerException
- Indicates that set2 is null.public abstract IntSet minus(IntSet set2)
set2
- the second set in the subtractionNullPointerException
- Indicates that the argument is null.OutOfMemoryError
- Indicates insufficient memory for the new set.public abstract boolean remove(int target)
target
- the element to be removed from the setpublic abstract int size()
public abstract void subtract(IntSet set2)
set2
- a set whose elements will be subtracted from this setNullPointerException
- Indicates that set2 is null.public abstract int[] toArray()
public abstract String toString()
public abstract IntSet union(IntSet set2)
set2
- the second set in the unionNullPointerException
- Indicates that the argument is null.OutOfMemoryError
- Indicates insufficient memory for the new set.