Home » Java Collection spliterator() Method with Examples

Java Collection spliterator() Method with Examples

by Online Tutorials Library

Java Collection spliterator() Method

The spliterator() method of Collection Interface returns a Spliterator across the elements of this collection.

Syntax

Parameters

NA

Specified By

The spliterator() method of Collection class is specified by:

  • Spliterator() method in interface Iterable<E>.

Return Value

The spliterator() method returns a Spliterator across the elements of this collection.

Example 1

Test it Now

Output:

Values : 1 2 3 4 5 6 7 8 9 10  

Example 2

Test it Now

Output:

1 ID No = 15   Name = Reema panda   Age = 21    2 ID No = 16   Name = Geetanjali Sharma   Age = 21    3 ID No = 17   Name = Ajeet Kumar Maurya XI   Age = 36  

Example 3

Test it Now

Output:

Values : A B C D E F G H I J K L M N O P Q R S T U V W X Y Z  
Next TopicJava Collection

You may also like