Ordered Set

An ordered-set is an iterable collection of ordered unique elements. The elements are expected to be iterated over in order, based on their values.

/**
 * Ordered set of arbitrary values.
 * Iteration order is based on the values.
 *
 * @param <T> Element type.
 */
public interface OrderedSet<T extends Comparable<T>> extends Set<T> {
  // Same operations as the Set ADT
}

Notice we must use bounded generics to ensure the elements are comparable (otherwise, we cannot put them in order).