Online Java Compiler By
JavaTpoint.com
import java.util.Collection; import java.util.concurrent.ConcurrentLinkedQueue; public class JavaCollectionIsEmptyExample1 { public static void main(String[] args) { Collection
collection = new ConcurrentLinkedQueue
(); //returns true if the queue is empty if(collection.isEmpty()){ System.out.println("The queue is empty."); } else{ System.out.println("Elements are : "+collection); } } }
Output