toSet method

Set<E> toSet ()
override

Return a comparator based set using the comparator of this queue.

The queue is not modified.

The returned Set is currently a SplayTreeSet, but this may change as other ordered sets are implemented.

The set contains all the elements of this queue. If an element occurs more than once in the queue, the set will contain it only once.

Implementation

Set<E> toSet() {
  Set<E> set = new SplayTreeSet<E>(comparison);
  for (int i = 0; i < _length; i++) {
    set.add(_queue[i]);
  }
  return set;
}