package devmanuals.com; import java.util.Deque; import java.util.LinkedList; public class DequeSize { public static void main (String args []){ int size; Deque dq=new LinkedList(); dq.add(1); dq.add(2); dq.add(3); dq.add(4); dq.add(5); dq.add(6); System.out.println("Is deque empty ? "+dq.isEmpty()); if (dq != null) { System.out.println("Deque is : "+dq); } else System.out.println("Deque have no elements " +dq); size= dq.size(); System.out.println("Size of deque : "+size); //When remove the elements from list dq.clear(); System.out.println("Is Deque empty ? "+dq.isEmpty()); System.out.println("Deque have no elements " +dq); System.out.println("Size of deque : " +dq.size()); } }