12:45 am - Monday August 21, 2017

Collections example program for asLifoQueue(Deque deque)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

/**
@description:Collections Example program for asLifoQueue(Deque deque)
@author:candidjava.com
*/
import java.util.ArrayDeque;
import java.util.Collections;
import java.util.Deque;
import java.util.Queue;
public class CollectionAsLifoQueue {
public static void main(String args[])
{
Deque dq = new ArrayDeque(5);        //creating Deque obj
dq.add("KING");
dq.add("mani");            //adding deque values
dq.add("sathis");
dq.add("santhosh");
dq.add("santhanam");
Queue q = Collections.asLifoQueue(dq);          //changing into queue
System.out.println("Lifo Queue is: " +q );        //printing values
}}

OUTPUT:

Lifo Queue is: [KING, mani, sathis, santhosh, santhanam]

BACK

Filed in: Z-A All Java Codes

Comments are closed.