

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object  +org.metasyntactic.utilities.SetUtilities
A set is a collection of distinguishable objects, called its members or elements. If an object x is a member of a set S, we write x ∈ S (read "x is a member of S" or, more briefly, "x is in S"). If x is not a member of S, we write x ∉ S. We can describe a set by explicitly listing its members as a list inside braces. For example, we can define a set S to contain precisely the numbers 1, 2, and 3 by writing S = {1, 2, 3}. Since 2 is a member of the set S we can write 2 ∈ S, and since 4 is not a member, we have 4 ∉ S. A set cannot contain the same object more then once, and its elements are not ordered. Two sets A and B are equal, written A = B, if they contain the same elements. For example, {1, 2, 3, 1} = {1, 2, 3} = {3, 2, 1}.
We adopt special notations for frequently encountered sets.
For any set A, we have A ⊆ A. For two sets A and B, we have A = B if and only if A ⊆ B and B ⊆ A. For any three sets A, B, and C, if A ⊆ B and B ⊆ C, then A ⊆ C. For any set A we have ∅ ⊆ A.
Method Summary  
static java.util.Set 
difference(java.util.Collection c1,
java.util.Collection c2)
The difference of sets A and B is the set 
static java.util.Set 
difference(java.util.TreeSet c1,
java.util.TreeSet c2)

static java.util.Set 
intersection(java.util.Collection c1,
java.util.Collection c2)
The intersection of sets A and B is the set 
static java.util.Set 
intersection(java.util.TreeSet c1,
java.util.TreeSet c2)

static void 
main(java.lang.String[] args)

static java.util.Set 
powerSet(java.util.Set s)
The set of all subsets of a set S, including the empty set and the set S itself, is denoted 2^{S} and is called the power set of S. 
static java.lang.String 
toString(java.util.Set s)
A singleton is a Set with only one element. 
static java.util.Set 
union(java.util.Collection c1,
java.util.Collection c2)
The union of sets A and B is the set 
static java.util.Set 
union(java.util.TreeSet c1,
java.util.TreeSet c2)

Methods inherited from class java.lang.Object 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Method Detail 
public static java.util.Set intersection(java.util.Collection c1, java.util.Collection c2)
The intersection of sets A and B is the set
A ∩ B = {x  x ∈ A and x ∈ B}.
Note! Neither set is affected by this operation. To make this set equal to the intersection of itself and c use retainAll(Collection c)
#retainAll(Collection c)
public static java.util.Set intersection(java.util.TreeSet c1, java.util.TreeSet c2)
public static java.util.Set union(java.util.Collection c1, java.util.Collection c2)
The union of sets A and B is the set
A ∪ B = {x  x ∈ A or x ∈ B}.
Note! Neither set is affected by this operation. TO make this set equal to the union of itself and c use addAll(Collection c)
#addAll(Collection c)
public static java.util.Set union(java.util.TreeSet c1, java.util.TreeSet c2)
public static java.util.Set difference(java.util.Collection c1, java.util.Collection c2)
The difference of sets A and B is the set
A  B = {x  x ∈ A and x ∉ B}.
Note! Neither set is affected by this operation. To make this set equal to the difference of itself and c use removeAll(Collection c)
#removeAll(Collection c)
public static java.util.Set difference(java.util.TreeSet c1, java.util.TreeSet c2)
public static java.util.Set powerSet(java.util.Set s)
Note! powerSet does not convert this set into a power set. It merely returns the powerset of this set
public static java.lang.String toString(java.util.Set s)
public static void main(java.lang.String[] args)


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 