Java interface that returns objects with its own type

I was looking at an interface that is built into Java, and noticed that it has methods which return objects of its own type. Specifically, the IntStream interface has a method range which returns an IntStream object (i.e. some object that implements IntStream). This method can be used by only importing the interface, as follows:… Read More Java interface that returns objects with its own type