This is a code i found for Egit
I am new to the usage of PlotCommitList<L extends PlotLane>.
- what is the term used for it?
- what does it signify or mean to the compiler?
public class PlotCommitList<L extends PlotLane> extends RevCommitList<PlotCommit<L>> {
The <> operator is used to specify classes in generic templates.
Image a generic “list”. In Java up to 1.4, a “list” could only contain generic
Objects.If you wanted to make sure you only kept
Strings in your list you had to use a lot of casting and helper methods, which made the code barely readable.Java 5 introduced generics, which solves the problem – you can create a template class “list of “, and parametrise the class used as parameter or return value.
Furthermore, you can use the
<L extends ...>and<L super ...>to limit the range of classes your template works with, have multiple classes as parameters<class1,class2>and combine things up<class1,class2<class3>>at will.There is a very good tutorial at http://www.javacodegeeks.com/2011/04/java-generics-quick-tutorial.html