Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 24270e3

Browse files
Update List.java
1 parent a3255e3 commit 24270e3

File tree

1 file changed

+2
-3
lines changed
  • algorithms/src/main/java/ivanmarkovic/algorithms/linkedlists/circularsinglylinkedlist

1 file changed

+2
-3
lines changed

‎algorithms/src/main/java/ivanmarkovic/algorithms/linkedlists/circularsinglylinkedlist/List.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,12 @@ public void printAll() {
4444

4545
public void addToHead(int payload) {
4646
if(this.isEmpty()) {
47-
this.head = this.tail = new Node(payload);
48-
this.tail.next = this.head;
47+
this.head = this.tail = new Node(payload);
4948
}
5049
else {
5150
this.head = new Node(payload, this.head);
52-
this.tail.next = this.head;
5351
}
52+
this.tail.next = this.head;
5453
}
5554

5655
public void addToTail(int payload) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /