code: public static SortedSet<ClassLabel> getClassLabels(Relation<? extends ClassLabel> database) {
      SortedSet<ClassLabel> labels = new TreeSet<>();
      for(DBIDIter it = database.iterDBIDs(); it.valid(); it.advance()) {
        labels.add(database.get(it));
      }
      return labels;
    }
docs: Retrieves all class labels within the database.
  
  @param database the database to be scanned for class labels
  @return a set comprising all class labels that are currently set in the
  database