What is the difference between Comparable and Comparator?

Comparable built into the type — Employee implements compareTo by id. Comparator external — sort by name or salary without changing Employee. Use...

What is the difference between Comparable and Comparator? · Home · Support the platform