I came across this definition of a class that was written by someone else:
BaseClass<E extends BaseClass<E>>
All of the class's methods are then defined this way:
public<E> E setX(...) {
// do stuff
return this;
}
And an object of class BaseClass is used like this:
base.setX(..).setY(..).setZ()..
And it got me wondering as to how it works,why does it even compile,why it's used this way and if it's good practice to declare a class to extend itself.
Any help would be much appreciated.