import java.util.*;
class ZahlenMenge {
  /** Methode zur Ausgabe von Infos ueber eine Collection */
  public static void printInfo(Collection c) {
    System.out.println("Die Menge enthaelt " + c.size() + " Elemente");
    System.out.println("Ist 3.3 in der Menge enthalten? " + 
                       c.contains(new Double(3.3)));
    System.out.println("Alle Elemente der Menge:");
    for (Iterator i = c.iterator(); i.hasNext(); )
      System.out.print(i.next() + "   ");
    System.out.println();
    System.out.println();
  }

  /** Aufbau und Modifikation einer Collection */
  public static void main(String[] args) {
    Collection<Double> c = new HashSet<Double>();
    c.add(new Double(1.1));
    c.add(new Double(2.2));
    c.add(new Double(3.3));
    c.add(new Double(0.0));
    c.add(new Double(3.3));
    c.add(new Double(4.4));
    printInfo(c);
    c.remove(new Double(3.3));
    c.remove(new Double(0.0));
    c.remove(new Double(4.4));
    printInfo(c);
  }
}

