Java HashSet spliterator() MethodThe spliterator() method of Java HashSet class is used to creates a late-binding and fail-fast Spliterator over the elements in this set. SyntaxFollowing is the declaration of spliterator() method: ParameterThis method does not accept any parameter. ReturnsThe spliterator() method returns a Spliterator over the elements in this set. ExceptionsNA Compatibility Version1.8 and above Example 1Test it NowOutput: Java Android JavaScript Example 2Test it NowOutput: spliterator of HashSet is: 3 Example 3Test it NowOutput: Apple --Bulk List traversal--- Banana Orange Graps --- Attempting tryAdvance again--- Element exists: false
Next TopicHashSet class Method
|