Interface Sorter<T>

Type Parameters:
T - type of elements in queue.
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Sorter<T>
A sorter sorts it input. The implementation is expected to return the same queue instance.
Author:
Pieter van den Hombergh
  • Method Summary

    Modifier and Type
    Method
    Description
    sort(Queue<T> queue, Comparator<T> comparator)
    Return the input queue in sorted order, based on the passed comparator.
  • Method Details

    • sort

      Queue<T> sort(Queue<T> queue, Comparator<T> comparator)
      Return the input queue in sorted order, based on the passed comparator.
      Parameters:
      queue - to be sorted
      comparator - to base sorting on
      Returns:
      the queue with the elements in non-descending order as per the comparator.