summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/Listing1505.java
blob: ea82f54421478901652af2ec1f69bdfda923c4fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Listing1505.java */

import java.util.*;

public class Listing1505
{
  public static void main(String[] args)
  {
    //Konstruieren des Sets
    TreeSet s = new TreeSet();
    s.add("Kiwi");
    s.add("Kirsche");
    s.add("Ananas");
    s.add("Zitrone");
    s.add("Grapefruit");
    s.add("Banane");
    //Sortierte Ausgabe
    Iterator it = s.iterator();
    while (it.hasNext()) {
      System.out.println((String)it.next());
    }
  }
}