I've read the whole SCJP6 book Sierra and Bates book, scored 88% the exam.
But still, i never heard of how this kind of code works as it's not explained in the generics chapter:
Collections.<TimeUnit>reverseOrder()
What is this kind of generics usage? I discovered it in some code but never read anything about it. It seems to me it permits to give some help to type inference. I've tried to search about that but it's not so easy to find (and it's not even in the SCJP book/exam!)
So can someone give me a proper explaination of how it works, which are all the usecases etc?
Thanks
Edit Thanks for the answers but i expected more details :) so if someone want to add some extra informations:
What about more complex cases like
- Using a type declared in class , can i do something like
Collections.<T>reverseOrder()
for exemple? - Using
extends
,super
? - Using
?
- Giving the compiler only partial help (ie
O.manyTypesMethod<?,MyHelpTypeNotInfered,?,?,?,?,?>()
)