Queue, Deque, Stack, Math
Queue, Deque and Stack collections plus common java.lang.Math methods.
Queue is FIFO: offer()/add() enqueue, poll()/remove() dequeue, peek()/element() inspect. Deque adds both-end operations like addFirst/addLast. ArrayDeque is a resizable-array Deque, faster than LinkedList, and works as a stack. PriorityQueue is a natural-order heap: poll() returns the smallest; null is disallowed. Legacy Stack extends Vector (push/pop/peek); Deque is preferred. java.lang.Math provides abs, max, min, pow, sqrt, random() in [0,1).
Example
int m = Math.max(3, 7);
double r = Math.random();
No comments yet.