public interface Set<T>
extends java.lang.Iterable<T>
Modifier and Type | Method and Description |
---|---|
void |
add(Set<T> S)
Add every element in Set S into this Set.
|
void |
add(T e)
Add e into this Set.
|
boolean |
contains(Set<T> S)
Subset.
|
Set<T> |
diff(Set<T> S)
Difference.
|
boolean |
equals(java.lang.Object o)
Standard equals method.
|
boolean |
has(T e)
Membership.
|
Set<T> |
intersect(Set<T> S)
Intersection.
|
boolean |
isEmpty()
Check empty.
|
void |
remove(Set<T> S)
Remove every element in Set S from this Set.
|
void |
remove(T e)
Remove e from this Set.
|
T |
removeOne()
Remove and return the first element from this Set, where the meaning of "first" is open
to the implementation.
|
int |
size()
Cardinality (size) of this Set
|
java.lang.Object[] |
toArray()
Standard toArray() method.
|
T[] |
toArray(T[] a)
Standard toArray() method with array parameter
|
java.lang.String |
toString()
Standard toString method.
|
Set<T> |
union(Set<T> S)
Union.
|
int size()
boolean isEmpty()
Set<T> intersect(Set<T> S)
S
- another Set of TSet<T> union(Set<T> S)
S
- another Set of Tboolean has(T e)
e
- is a Tboolean contains(Set<T> S)
S
- is Set of Tvoid add(T e)
e
- is a T.T removeOne()
void remove(T e)
e
- is a Tvoid remove(Set<T> S)
S
- is a Set of Tjava.lang.Object[] toArray()
T[] toArray(T[] a)
a
- if a's size is big enough, use a, otherwise new a sufficient array.java.lang.NullPointerException
- will be thrown if a is null.java.lang.String toString()
toString
in class java.lang.Object
boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- is the object to be compared