Java ConcurrentLinkedQueue isEmpty() MethodThe isEmpty() method of ConcurrentLinkedQueue class returns a Boolean value true if the defined queue contains no element. The isEmpty() method of class ConcurrentLinkedQueue is overrided by isEmpty() method in class AbstractCollection<E>. SyntaxParameterNA Specified ByThe isEmpty() method of ConcurrentLinkedQueue class is specified by isEmpty()method in interface Collection<E>. Return ValueThe isEmpty() method returns Boolean value true if the defined queue contains no element. Example 1Test it NowOutput: Elements are : [1, 2, 3, 4, 5] Example 2Test it NowOutput: isEmpty() method returns true Add some elements because the queue is empty. Example 3Output: Enter five names 1. Name = Reema 2. Name = Himanshu 3. Name = Rahul Queue : [Reema, Himanshu, Rahul]
Next TopicJava ConcurrentLinkedQueue
|