// this is the second problem, please understand this solution is provided as an 
// example only, since there are many other ways in which you could have approached
// this problem as the TAs should have discussed them with you in lab/office hours

import java.util.*;

public class Second { // this is problem R15.19
  public static HashSet<String> unionSet(LinkedList<String> u1, LinkedList<String> u2){
    HashSet<String> staff = new HashSet<String>(u1);
    staff.addAll(u2);
    return staff;
  }
  public static HashSet<String> intersectionSet(LinkedList<String> u1, LinkedList<String> u2){
    HashSet<String> staff = new HashSet<String>(u2);
    staff.retainAll(u1);
    return staff;
  }
  
  public static void main(String[] args) {
    LinkedList<String> staff1 = new LinkedList<String>();
    staff1.add("a");
    staff1.add("b");
    staff1.add("c");
    LinkedList<String> staff2 = new LinkedList<String>();
    staff2.add("a");
    staff2.add("b");
    staff2.add("d");   
    System.out.println(unionSet(staff1,staff2).toString());
    System.out.println(intersectionSet(staff1,staff2).toString());
  }
}