Queue: add(String e) : Queue « java.util « Java by API






Queue: add(String e)

  

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

public class Main {

  public static void main(String[] args) {
    Queue<String> queue = new LinkedList<String>();
    queue.add("Hello");
    queue.add("World");
    List<String> list = new ArrayList<String>(queue);

    System.out.println(list);
  }

}

   
    
  








Related examples in the same category

1.Queue: element()
2.Queue: peek()
3.Queue: poll()
4.Queue: size()