Arrays.stream(long[]): This method is available in java.util.Arrays class of Java.
Syntax:
LongStream java.util.Arrays.stream(long[] array)
This method takes one argument of type long array as its parameter. This method returns a sequential LongStream with the specified array as its source.
Parameters: One parameter is required for this method.
array: the array, assumed to be unmodified during use.
Returns: a LongStream for the array.
Exceptions: NA
Approach
Java
import java.util.Arrays;public class Arraysstreamlong {public static void main(String[] args) {long array[] = { 1, 2, 10, 5 };System.out.println(Arrays.stream(array).count());}}
Output:
4
No comments:
Post a Comment