my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Generics: how to read Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Generics: how to read " Watch "Generics: how to read " New topic
Author

Generics: how to read

Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
I look at the Collections.java source and found this method header:


how to understand/read the return part


in plain english

thanks


SCJP 5
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
There is no return part - the method is returning void. The input list is sorted in place.

The <T extends Comparable<? super T>> is the condition on the parameter type of the list to be sorted: List<T>

I read it as "The input parameter is a list of objects of type T such that T must be comparable with an object of the same type or comparable to a superclass of the same type T".
[ July 21, 2006: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Generics: how to read
 
Similar Threads
Sorting a stack
explain this declaration
Collections.binarySearch() problem
Need help finding assignments
Generic Question