LinkedList Method List
- Often using [*First] methods
- addFirst
- peekFirst
- pollFirst
- removeFirst
1
2
3
4
5
6
7
8
9
10
// if you want to make the reverse order list, use addFirst()
LinkedList<Integer> list = new LinkedList<>();
list.addFirst(1);
list.addFirst(2);
list.addFirst(3);
// list -> [3, 2, 1]
ArrayList VS LinkedList
- Manipulation with LinkedList is faster than ArrayList
Comments powered by Disqus.