Can anyone explain how IntStream is being used here? I don't understand the syntax. It looks like a class that is being instantiated, but there is no 'new' keyword. The API says it is an interface too.
I'm assuming you're referring to IntStream.range(5, 10). It's a static factory method. It's a static method that creates an instance of some class that implements IntStream. Static methods can be called on a type without creating an instance of that type first (in fact, calling a static method on an object reference is considered poor programming style).
Stephan van Hulst wrote:. . . a static method that creates an instance of some class . . .
One of the things you might notice about the classes introduced in Java8, e.g. those described in this part of the Java™ Tutorials, is that they often have their constructors hidden away and use factory methods to provide instances. There is a section in Joshua Bloch's Effective Java (page 5) about factory methods.