Skip to content

Constraining a type parameter

A generic method must call compareTo on its parameters.

java static <T extends Comparable<T>> T max(List<T> items)

What does the bound provide?