Javatpoint Logo
Javatpoint Logo

Java HashSet spliterator() Method

The spliterator() method of Java HashSet class is used to creates a late-binding and fail-fast Spliterator over the elements in this set.

Syntax

Following is the declaration of spliterator() method:

Parameter

This method does not accept any parameter.

Returns

The spliterator() method returns a Spliterator over the elements in this set.

Exceptions

NA

Compatibility Version

1.8 and above

Example 1

Test it Now

Output:

Java
Android
JavaScript

Example 2

Test it Now

Output:

spliterator of HashSet is: 3

Example 3

Test it Now

Output:

Apple
--Bulk List traversal---
Banana
Orange
Graps
 --- Attempting tryAdvance again---
Element exists: false





Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA