Skip to content

Accepting anything that can be compared

A generic method must sort its input. Writing it for an unbounded type parameter fails to compile, because nothing guarantees the elements can be compared.

What is the right approach?