Java PriorityQueue size() MethodThe size() method of PriorityQueue class returns the number of elements contained by this collection. If there are more than Integer.MAX_VALUE elements in this collection, the method returns Integer.MAX_VALUE. SyntaxParameterNA Specified ByThe size() method of PriorityQueue class is specified by:
Return ValueThe size() method returns the count of elements contained by this collection. Example 1Output: First PriorityQueueis : [123, 375, 258, 682, 842, 654, 556, 998] The size of first queue is: 8 Second PriorityQueueis : [Gaurav, Hitesh] The size of second queue is: 2 Example 2Output: The strength of Btech_Cse is 5 Example 3Output: 2 elements = [Himanshu, Rinku] 0 elements = [] Next TopicJava-priorityqueue-spliterator-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India