ServiceLoader spliterator() in Java

spliterator(): This method is available in java.util.ServiceLoader class of Java.

Syntax:

Spliterator<K> java.lang.Iterable.spliterator()

This method creates a Spliterator over the elements described by this Iterable.

Parameters: NA

Returns:Spliterator over the elements described by this Iterable.

Exceptions: NA

Approach

Java

import java.util.ServiceLoader;

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

        ServiceLoader<String> serviceLoader =
ServiceLoader.load(String.class);

        System.out.println(serviceLoader.spliterator());
    }

}

Output:

java.util.Spliterators$IteratorSpliterator@3a4afd8d


No comments:

Post a Comment