Java 8 has a new interface, named IntStream
. I used its of()
static method and encountered a strange error:
This static method of interface
IntStream
can only be accessed asIntStream.of
But as you can see in the following code, I, exactly, used IntStream.of
import java.util.stream.IntStream;
public class Test {
public static void main(String[] args) {
int[] listOfNumbers = {5,4,13,7,7,8,9,10,5,92,11,3,4,2,1};
System.out.println(IntStream.of(listOfNumbers).sum());
}
}
Moreover, if you check the API, you will see that the method has been declared in the similar way which I used.