Sponsered Links
Categories
Sponsered Links

Java convert Queue to List Example

 

This is a simple Java convert Queue to List Example.

import java.util.List;
import java.util.Queue;
import 
java.util.ArrayList;
import java.util.LinkedList;

public class ArrListExample {
   public void QueueToList() {
        Queue queue = new LinkedList();
       
queue.add("Sachin");
       
queue.add("Rahul");
       
queue.add("Saurabh");
       
queue.add("Sehwag");
    
    List list = new ArrayList(
queue);
    for (Object obj :
list)
      System.out.println(
obj);
    }
    public static void main(String[] args) {
      new
ArrListExample().QueueToList();
    }
}

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved