Queue<Integer> queue = new LinkedList<Integer>();
static <E> List<E> heapSort(Collection<E> c) { Queue<E> queue = new PriorityQueue<E>(c); List<E> result = new ArrayList<E>(); while (!queue.isEmpty()) result.add(queue.remove()); return result; } |
ArrayList
ArrayList<Integer> list = new ArrayList<Integer>(); ArrayList() Constructs an empty list with an initial capacity of ten. ArrayList(Collection<? extends E> c) Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator. ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity. |
Cheatography
https://cheatography.com
Java Collections Quick Reference Cheat Sheet (DRAFT) by Onur
This is a draft cheat sheet. It is a work in progress and is not finished yet.