new ArrayList(Collection c) : ArrayList « java.util « Java by API






new ArrayList(Collection c)

  

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.new ArrayList < E > ()
2.ArrayList: add(E o)
3.ArrayList: add(int index, E element)
4.ArrayList: addAll(Collection c)
5.ArrayList: addAll(int index, Collection c)
6.ArrayList: clear()
7.ArrayList: contains(Object elem)
8.ArrayList: equals(Object o)
9.ArrayList: ensureCapacity(int minCapacity)
10.ArrayList: get(int index)
11.ArrayList: indexOf(Object elem)
12.ArrayList: isEmpty()
13.ArrayList: iterator()
14.ArrayList: lastIndexOf(Object o)
15.ArrayList: listIterator()
16.ArrayList: remove(int index)
17.ArrayList: remove(Object o)
18.ArrayList: removeAll(Collection c)
19.ArrayList: retainAll(Collection c)
20.ArrayList: set(int index, T element)
21.ArrayList: size()
22.AbstractList: subList(int fromIndex, int toIndex)
23.ArrayList: toArray()
24.ArrayList: toArray(T[] a)
25.ArrayList: trimToSize()
26.for each loop for ArrayList