Java 8 has a new interface called IntStream . I used the static of() method and found a strange error:
This static IntStream interface IntStream is only available as IntStream.of
But, as you can see in the following code, I definitely 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()); } }
Also, if you check the API , you will see that the method was declared in the same way that I used.
source share