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

Method addFirst

12_LinkedList.java/LL.java:14–23  ·  view source on GitHub ↗
(int data)

Source from the content-addressed store, hash-verified

12 public static int size;
13
14 public void addFirst(int data) {
15 size++;
16 Node newNode = new Node(data);
17 if(head == null) {
18 head = tail = newNode;
19 } else {
20 newNode.next = head;
21 head = newNode;
22 }
23 }
24
25 public void addLast(int data) {
26 size++;

Callers 1

addMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected