Intersection Types in Java Generics

Today, I was looking at JDK 8 Collections.max function declaration and noticed a weird & in the type declaration. Most normal Java developers will not remember exact function declaration so I am writing it below.

public static <T extends Object & Comparable<? super T>> T max(Collection<? extends T> coll)

Continue reading “Intersection Types in Java Generics”