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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -