MCPcopy Create free account
hub / github.com/apna-college/Alpha / addFirst

Method addFirst

12_LinkedList.java/DLL.java:18–29  ·  view source on GitHub ↗
(int data)

Source from the content-addressed store, hash-verified

16 public static int size;
17
18 public void addFirst(int data) {
19 size++;
20 Node newNode = new Node(data);
21 if(head == null) {
22 head = tail = newNode;
23 return;
24 }
25
26 head.prev = newNode;
27 newNode.next = head;
28 head = newNode;
29 }
30
31 public void print() {
32 Node temp = head;

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected