Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

push_back() and push_front() in Java

Is there any collection class in java, that implements push_back() and push_front() methods?

like image 462
George Avatar asked Jan 22 '10 11:01

George


2 Answers

The class java.util.LinkedList has addFirst/Last(), getFirst/last() and removeFirst/Last().

like image 80
Jerome Avatar answered Sep 25 '22 06:09

Jerome


Any collection that implements Deque should have it (ArrayDeque, LinkedList)

like image 29
fn. Avatar answered Sep 24 '22 06:09

fn.