Arrays.spliterator(int[]) in Java

Arrays.spliterator(int[]): This method is available in java.util.Arrays class of Java.

Syntax:

OfInt java.util.Arrays.spliterator(int[] array)

This method takes one argument of type int array as its parameter. This method returns a Spliterator.OfInt covering all of the specified array.

Parameters: One parameter is required for this method.

array: the array, assumed to be unmodified during use.

Returns: a spliterator for the array elements.

Exceptions: NA

Approach

Java

import java.util.Arrays;

public class Arraysspliteratorint {
    public static void main(String[] args) {

        int array[] = { 1, 2, 10, 5 };

        System.out.println(Arrays.spliterator(array));
    }
}

Output:

java.util.Spliterators$IntArraySpliterator@39ed3c8d


No comments:

Post a Comment