Skip to content

Commit 4904bde

Browse files
committed
style: include NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION
1 parent dbe2a42 commit 4904bde

File tree

6 files changed

+10
-13
lines changed

6 files changed

+10
-13
lines changed

spotbugs-exclude.xml

-3
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@
126126
<Match>
127127
<Bug pattern="OCP_OVERLY_CONCRETE_PARAMETER" />
128128
</Match>
129-
<Match>
130-
<Bug pattern="NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION" />
131-
</Match>
132129
<Match>
133130
<Bug pattern="LSC_LITERAL_STRING_COMPARISON" />
134131
</Match>

src/main/java/com/thealgorithms/ciphers/a5/CompositeLFSR.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public boolean clock() {
2626

2727
private boolean getMajorityBit() {
2828
Map<Boolean, Integer> bitCount = new TreeMap<>();
29-
bitCount.put(false, 0);
30-
bitCount.put(true, 0);
29+
bitCount.put(Boolean.FALSE, 0);
30+
bitCount.put(Boolean.TRUE, 0);
3131

3232
registers.forEach(lfsr -> bitCount.put(lfsr.getClockBit(), bitCount.get(lfsr.getClockBit()) + 1));
33-
return bitCount.get(false) <= bitCount.get(true);
33+
return bitCount.get(Boolean.FALSE) <= bitCount.get(Boolean.TRUE);
3434
}
3535
}

src/main/java/com/thealgorithms/datastructures/graphs/DIJSKSTRAS_ALGORITHM.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ void dijkstra(int[][] graph, int src) {
3434

3535
for (int i = 0; i < k; i++) {
3636
dist[i] = Integer.MAX_VALUE;
37-
Set[i] = false;
37+
Set[i] = Boolean.FALSE;
3838
}
3939

4040
dist[src] = 0;
4141

4242
for (int c = 0; c < k - 1; c++) {
4343
int u = minDist(dist, Set);
4444

45-
Set[u] = true;
45+
Set[u] = Boolean.TRUE;
4646

4747
for (int v = 0; v < k; v++) {
4848
if (!Set[v] && graph[u][v] != 0 && dist[u] != Integer.MAX_VALUE && dist[u] + graph[u][v] < dist[v]) {

src/main/java/com/thealgorithms/datastructures/graphs/PrimMST.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void primMST(int[][] graph) {
5050
// Initialize all keys as INFINITE
5151
for (int i = 0; i < V; i++) {
5252
key[i] = Integer.MAX_VALUE;
53-
mstSet[i] = false;
53+
mstSet[i] = Boolean.FALSE;
5454
}
5555

5656
// Always include first 1st vertex in MST.
@@ -65,7 +65,7 @@ void primMST(int[][] graph) {
6565
int u = minKey(key, mstSet);
6666

6767
// Add the picked vertex to the MST Set
68-
mstSet[u] = true;
68+
mstSet[u] = Boolean.TRUE;
6969

7070
// Update key value and parent index of the adjacent
7171
// vertices of the picked vertex. Consider only those

src/main/java/com/thealgorithms/greedyalgorithms/JobSequencing.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public int compareTo(Job otherJob) {
3131
// Function to print the job sequence
3232
public static String findJobSequence(ArrayList<Job> jobs, int size) {
3333
Boolean[] slots = new Boolean[size];
34-
Arrays.fill(slots, false);
34+
Arrays.fill(slots, Boolean.FALSE);
3535

3636
int[] result = new int[size];
3737

@@ -40,7 +40,7 @@ public static String findJobSequence(ArrayList<Job> jobs, int size) {
4040
for (int j = jobs.get(i).deadline - 1; j >= 0; j--) {
4141
if (!slots[j]) {
4242
result[j] = i;
43-
slots[j] = true;
43+
slots[j] = Boolean.TRUE;
4444
break;
4545
}
4646
}

src/main/java/com/thealgorithms/sorts/CircleSort.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private <T extends Comparable<T>> Boolean doSort(T[] array, int left, int right)
2525
boolean swapped = false;
2626

2727
if (left == right) {
28-
return false;
28+
return Boolean.FALSE;
2929
}
3030

3131
int low = left;

0 commit comments

Comments
 (0)