

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
public interface Set<E>
Implementation of a set of elements. As with the mathematical object, the elements of the set are not duplicated. No order is implied or enforced in this structure, but simple set operations such as intersection, union, difference, and subset are provided.
Example Usage: Given a list of students who completed a computer science thesis in the 20012002 academic year at Williams College and a list of graduating computer science majors who are continuing on to graduate school, we could determine which thesis students are planning to attend graduate school as follows:
public static void main(String[] argv){ //thesis students in the class of '02 String[] thesis = new String[]{"Doug", "Evan", "Feng"}; //students continuing on to grad school String[] grad = new String[]{"Doug", "Feng", "Lida"}; //instantiate our sets Set thesisSet = newstructure.SetVector#SetVector()
, gradSet = newstructure.SetVector#SetVector()
; //build sets up for(int i = 0; i < thesis.length; i++) thesisSet.add(thesis[i])
; for(int i = 0; i < grad.length; i++) gradSet.add(grad[i])
; //calculate the intersection of the two sets thesisSet.retainAll(gradSet)
; System.out.println(thesisSet); }
Method Summary  

void 
addAll(Structure<E> other)
Union other set into this set. 
boolean 
containsAll(Structure<E> other)
Check to see if this set is contained in the other structure. 
void 
removeAll(Structure<E> other)
Computes the difference between this set and the other structure 
void 
retainAll(Structure<E> other)
Computes the intersection between this set and the other structure. 
Methods inherited from interface structure5.Structure 

add, clear, contains, elements, isEmpty, iterator, remove, size, values 
Method Detail 

void addAll(Structure<E> other)
boolean containsAll(Structure<E> other)
void removeAll(Structure<E> other)
void retainAll(Structure<E> other)


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