I am trying to generate random array of integers using new Stream API in Java 8. But I haven\'t understood this API clearly yet. So I need help. Here is my code.
To generate random numbers from range 0 to 350, limiting the result to 10, and collect as a List. Later it could be typecasted.
However, There are no guarantees on the type, mutability, serializability, or thread-safety of the List returned.
List
and to get thearray of int use
int[] numbers = new Random().ints(0,350).limit(10).toArray();