java - Signature of Collections.min/max method -
in java, collections class contains following method:
public static <t extends object & comparable<? super t>> t min(collection<? extends t> c)
its signature well-known advanced use of generics, mentioned in java in nutshell book , in official sun generics tutorial.
however, not find convincing answer following question:
why formal parameter of type collection<? extends t>
, rather collection<t>
? what's added benefit?
one benefit of ?
prohibits additions of items collection
Comments
Post a Comment