Java PriorityQueue spliterator() Method

The spliterator() method of the PriorityQueue class creates a late-binding and fail-fast Spliterator that does not traverse the elements in any particular order in this queue.

Syntax

Parameter

NA

Specified By

The spliterator() method of the PriorityQueue class is specified by:

  1. spliterator in interface Collection<E>.
  2. spliterator in interface Iterable<E>.

Return Value

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

Example 1

Output:

1 Name - Avijit
2 Name - Bani
3 Name - Chehak

Example 2

Output:

1 Lower case = aman
1 Upper case = AMAN

2 Lower case = bhavika
2 Upper case = BHAVIKA

3 Lower case = chavi
3 Upper case = CHAVI

4 Lower case = chandan
4 Upper case = CHANDAN

Example 3

Output:

1 Roll No = 15cs1029
 Name = Reema panda
 Marks = 21

2 Roll No = 15cs1012
 Name = Geetanjali Sharma
 Marks = 26

3 Roll No = 15cs1011
 Name = HimanshuBhardwaj
 Marks = 27