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

Method removeFirst

12_LinkedList.java/DoubleLL.java:42–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40
41 //remove - removeLast
42 public int removeFirst() {
43 if(head == null) {
44 System.out.println("DLL is empty");
45 return Integer.MIN_VALUE;
46 }
47
48 if(size == 1) {
49 int val = head.data;
50 head = tail = null;
51 size--;
52 return val;
53 }
54 int val = head.data;
55 head = head.next;
56 head.prev = null;
57 size--;
58 return val;
59 }
60
61 public void reverse() {
62 Node curr = head;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected