Skip to content

Commit 0ba8aba

Browse files
style: fix indentation fully (no tabs)
1 parent 0f1bc22 commit 0ba8aba

1 file changed

Lines changed: 33 additions & 32 deletions

File tree

src/main/java/com/thealgorithms/datastructures/queues/ThreadSafeQueue.java

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,47 @@
22

33
public class ThreadSafeQueue<T> {
44

5-
private static class Node<T> {
6-
T data;
7-
Node<T> next;
5+
private static class Node<T> {
6+
T data;
7+
Node<T> next;
88

9-
Node(T data) {
10-
this.data = data;
11-
}
12-
}
9+
Node(T data) {
10+
this.data = data;
11+
}
12+
}
1313

14-
private Node<T> head;
15-
private Node<T> tail;
14+
private Node<T> head;
15+
private Node<T> tail;
1616

17-
public synchronized void enqueue(T data) {
18-
Node<T> newNode = new Node<>(data);
17+
public synchronized void enqueue(T data) {
18+
Node<T> newNode = new Node<>(data);
1919

20-
if (tail == null) {
21-
head = tail = newNode;
22-
return;
23-
}
20+
if (tail == null) {
21+
head = newNode;
22+
tail = newNode;
23+
return;
24+
}
2425

25-
tail.next = newNode;
26-
tail = newNode;
27-
}
26+
tail.next = newNode;
27+
tail = newNode;
28+
}
2829

29-
public synchronized T dequeue() {
30-
if (head == null) {
31-
return null;
32-
}
30+
public synchronized T dequeue() {
31+
if (head == null) {
32+
return null;
33+
}
3334

34-
T data = head.data;
35-
head = head.next;
35+
T data = head.data;
36+
head = head.next;
3637

37-
if (head == null) {
38-
tail = null;
39-
}
38+
if (head == null) {
39+
tail = null;
40+
}
4041

41-
return data;
42-
}
42+
return data;
43+
}
4344

44-
public synchronized boolean isEmpty() {
45-
return head == null;
46-
}
45+
public synchronized boolean isEmpty() {
46+
return head == null;
47+
}
4748
}

0 commit comments

Comments
 (0)