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

Method addFirst

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

Source from the content-addressed store, hash-verified

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

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected