Play audio slide show -- Keyboard shortcut: 'x'  Lecture overview -- Keyboard shortcut: 'u'  Previous page: Klasserne HashSet og TreeSet -- Keyboard shortcut: 'p'  Next page: Interfacet List -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home  Play sound for this slide -- Keyboard shortcut: 'y'    Collections og streams - slide 8 : 35

Et eksempel på anvendelse af Set 

import java.util.*;

public class FindDups {
  public static void main(String args[]){
    Set s = new HashSet();
    for (int i=0; i<args.length; i++)
        if (!s.add(args[i]))
            System.out.println("Duplicate detected: " + 
                                args[i]);
    System.out.println(s.size() + 
                       " distinct words detected: " +
                       s);
  }
}