Skip to content

Commit c5f3d85

Browse files
committed
style: include VA_FORMAT_STRING_USES_NEWLINE
1 parent 7bff82f commit c5f3d85

File tree

7 files changed

+8
-11
lines changed

7 files changed

+8
-11
lines changed

spotbugs-exclude.xml

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
<Match>
99
<Bug pattern="DMI_RANDOM_USED_ONLY_ONCE" />
1010
</Match>
11-
<Match>
12-
<Bug pattern="VA_FORMAT_STRING_USES_NEWLINE" />
13-
</Match>
1411
<Match>
1512
<Bug pattern="SF_SWITCH_NO_DEFAULT" />
1613
</Match>

src/main/java/com/thealgorithms/datastructures/hashmap/hashing/HashMapCuckooHashing.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public boolean checkTableContainsKey(int key) {
213213
public double checkLoadFactor() {
214214
double factor = (double) size / tableSize;
215215
if (factor > .7) {
216-
System.out.printf("Load factor is %.2f , rehashing table\n", factor);
216+
System.out.printf("Load factor is %.2f , rehashing table%n", factor);
217217
reHashTableIncreasesTableSize();
218218
}
219219
return factor;

src/main/java/com/thealgorithms/datastructures/hashmap/hashing/MainCuckooHashing.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static void main(String[] args) {
5454
break;
5555
}
5656
case 6: {
57-
System.out.printf("Load factor is: %.2f\n", h.checkLoadFactor());
57+
System.out.printf("Load factor is: %.2f%n", h.checkLoadFactor());
5858
break;
5959
}
6060
case 7: {

src/main/java/com/thealgorithms/datastructures/lists/CreateAndDetectLoop.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static void main(String[] args) {
8181

8282
System.out.println("Enter the number of elements to be inserted: ");
8383
int n = sc.nextInt();
84-
System.out.printf("Enter the %d elements: \n", n);
84+
System.out.printf("Enter the %d elements: %n", n);
8585
while (n-- > 0) {
8686
singlyLinkedList.insert(sc.nextInt());
8787
}

src/main/java/com/thealgorithms/others/TowerOfHanoi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static void shift(int n, String startPole, String intermediatePole, Strin
1212
// Shift function is called in recursion for swapping the n-1 disc from the startPole to
1313
// the intermediatePole
1414
shift(n - 1, startPole, endPole, intermediatePole);
15-
System.out.format("Move %d from %s to %s\n", n, startPole, endPole); // Result Printing
15+
System.out.format("Move %d from %s to %s%n", n, startPole, endPole); // Result Printing
1616
// Shift function is called in recursion for swapping the n-1 disc from the
1717
// intermediatePole to the endPole
1818
shift(n - 1, intermediatePole, startPole, endPole);

src/main/java/com/thealgorithms/searches/MonteCarloTreeSearch.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public Node monteCarloTreeSearch(Node rootNode) {
7878

7979
winnerNode = getWinnerNode(rootNode);
8080
printScores(rootNode);
81-
System.out.format("\nThe optimal node is: %02d\n", rootNode.childNodes.indexOf(winnerNode) + 1);
81+
System.out.format("%nThe optimal node is: %02d%n", rootNode.childNodes.indexOf(winnerNode) + 1);
8282

8383
return winnerNode;
8484
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ public static void main(String[] args) {
7171

7272
InsertionSort insertionSort = new InsertionSort();
7373
double insertionTime = measureApproxExecTime(insertionSort::sort, randomArray);
74-
System.out.printf("Original insertion time: %5.2f sec.\n", insertionTime);
74+
System.out.printf("Original insertion time: %5.2f sec.%n", insertionTime);
7575

7676
double insertionSentinelTime = measureApproxExecTime(insertionSort::sentinelSort, copyRandomArray);
77-
System.out.printf("Sentinel insertion time: %5.2f sec.\n", insertionSentinelTime);
77+
System.out.printf("Sentinel insertion time: %5.2f sec.%n", insertionSentinelTime);
7878

7979
// ~ 1.5 time sentinel sort is faster, then classical Insertion sort implementation.
80-
System.out.printf("Sentinel insertion is %f3.2 time faster than Original insertion sort\n", insertionTime / insertionSentinelTime);
80+
System.out.printf("Sentinel insertion is %f3.2 time faster than Original insertion sort%n", insertionTime / insertionSentinelTime);
8181
}
8282

8383
private static double measureApproxExecTime(Function<Double[], Double[]> sortAlgorithm, Double[] randomArray) {

0 commit comments

Comments
 (0)