I know that I can create a class in java like this:
public class test {/*some code*/}
But now I have this:
public class coada < T extends Number & Comparable < Number>> {
List <T> pq = new ArrayList <T>();
public void add(T e , List <T> c) {
c.add(e);
Collections.sort(c);
}
public void remove(List < ? extends Number> c) {
c.remove(0);
}
}
I don't understand the more complicated syntax of the angled brackets and parameter lists.
I have these questions:
Can someone clarify the syntax used in the example?
I know Java doesn't support multiple inheritance. So how are Number & Comparable possible?
I thought generics are used for collections, not classes, so, how can
class coadahave a type parameter?
Comparableis an interface and not a class?