I saw this pattern somewhere:
class A extends B {
}
This structure is a little unusual to extend a generic by specifying the new
You might do something like this when dealing with recursive data structures. For example, nodes in a graph or a tree could be defined as a collection of other nodes:
class Node extends AbstractList {
...
}
Equally you might see something like this if the abstract/generic type is meant for comparing objects of a similar type, such as is the case with java.lang.Comparable
:
class MyObject implements Comparable {
public int compareTo(MyObject other) { ... }
}