Skip to content

Commit 87cf891

Browse files
alxkmalxkmvil02
authored
style: use proper spelling (#5436)
checkstyle: fix typos, style Co-authored-by: alxkm <[email protected]> Co-authored-by: Piotr Idzik <[email protected]>
1 parent d189c3a commit 87cf891

File tree

7 files changed

+18
-19
lines changed

7 files changed

+18
-19
lines changed

pmd-exclude.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ com.thealgorithms.datastructures.crdt.LWWElementSet=UselessParentheses
1212
com.thealgorithms.datastructures.crdt.Pair=UnusedPrivateField
1313
com.thealgorithms.datastructures.graphs.AStar=UselessParentheses
1414
com.thealgorithms.datastructures.graphs.AdjacencyMatrixGraph=CollapsibleIfStatements,UnnecessaryFullyQualifiedName,UselessParentheses
15-
com.thealgorithms.datastructures.graphs.BipartiteGrapfDFS=CollapsibleIfStatements
15+
com.thealgorithms.datastructures.graphs.BipartiteGraphDFS=CollapsibleIfStatements
1616
com.thealgorithms.datastructures.graphs.Kruskal=UselessParentheses
1717
com.thealgorithms.datastructures.hashmap.hashing.HashMapCuckooHashing=UselessParentheses
1818
com.thealgorithms.datastructures.heaps.FibonacciHeap=UselessParentheses

src/main/java/com/thealgorithms/datastructures/graphs/BipartiteGrapfDFS.java renamed to src/main/java/com/thealgorithms/datastructures/graphs/BipartiteGraphDFS.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
*
1515
* Output : YES
1616
*/
17-
public final class BipartiteGrapfDFS {
18-
private BipartiteGrapfDFS() {
17+
public final class BipartiteGraphDFS {
18+
private BipartiteGraphDFS() {
1919
}
2020

2121
private static boolean bipartite(int v, ArrayList<ArrayList<Integer>> adj, int[] color, int node) {

src/main/java/com/thealgorithms/datastructures/lists/MergeKSortedLinkedlist.java renamed to src/main/java/com/thealgorithms/datastructures/lists/MergeKSortedLinkedList.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* @author Arun Pandey (https://github.com/pandeyarun709)
99
*/
10-
public class MergeKSortedLinkedlist {
10+
public class MergeKSortedLinkedList {
1111

1212
/**
1313
* This function merge K sorted LinkedList

src/main/java/com/thealgorithms/stacks/LargestRectangle.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public final class LargestRectangle {
1111
private LargestRectangle() {
1212
}
1313

14-
public static String largestRectanglehistogram(int[] heights) {
14+
public static String largestRectangleHistogram(int[] heights) {
1515
int n = heights.length;
1616
int maxArea = 0;
1717
Stack<int[]> st = new Stack<>();
@@ -32,7 +32,7 @@ public static String largestRectanglehistogram(int[] heights) {
3232
}
3333

3434
public static void main(String[] args) {
35-
assert largestRectanglehistogram(new int[] {2, 1, 5, 6, 2, 3}).equals("10");
36-
assert largestRectanglehistogram(new int[] {2, 4}).equals("4");
35+
assert largestRectangleHistogram(new int[] {2, 1, 5, 6, 2, 3}).equals("10");
36+
assert largestRectangleHistogram(new int[] {2, 4}).equals("4");
3737
}
3838
}

src/main/java/com/thealgorithms/strings/ReverseWordsInString.java

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ private ReverseWordsInString() {
1313
* @param s the input string
1414
* @return A string created by reversing the order of the words in {@code s}
1515
*/
16-
1716
public static String reverseWordsInString(final String s) {
1817
var words = s.trim().split("\\s+");
1918
Collections.reverse(Arrays.asList(words));

src/main/java/com/thealgorithms/strings/Upper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ public static void main(String[] args) {
1515
}
1616

1717
/**
18-
* Converts all of the characters in this {@code String} to upper case
18+
* Converts all the characters in this {@code String} to upper case
1919
*
2020
* @param s the string to convert
2121
* @return the {@code String}, converted to uppercase.
2222
*/
2323
public static String toUpperCase(String s) {
24-
if (s == null || "".equals(s)) {
24+
if (s == null || s.isEmpty()) {
2525
return s;
2626
}
2727
char[] values = s.toCharArray();

src/test/java/com/thealgorithms/stacks/LargestRectangleTest.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ void testLargestRectangleHistogramWithTypicalCases() {
1111
// Typical case with mixed heights
1212
int[] heights = {2, 1, 5, 6, 2, 3};
1313
String expected = "10";
14-
String result = LargestRectangle.largestRectanglehistogram(heights);
14+
String result = LargestRectangle.largestRectangleHistogram(heights);
1515
assertEquals(expected, result);
1616

1717
// Another typical case with increasing heights
1818
heights = new int[] {2, 4};
1919
expected = "4";
20-
result = LargestRectangle.largestRectanglehistogram(heights);
20+
result = LargestRectangle.largestRectangleHistogram(heights);
2121
assertEquals(expected, result);
2222

2323
// Case with multiple bars of the same height
2424
heights = new int[] {4, 4, 4, 4};
2525
expected = "16";
26-
result = LargestRectangle.largestRectanglehistogram(heights);
26+
result = LargestRectangle.largestRectangleHistogram(heights);
2727
assertEquals(expected, result);
2828
}
2929

@@ -32,19 +32,19 @@ void testLargestRectangleHistogramWithEdgeCases() {
3232
// Edge case with an empty array
3333
int[] heights = {};
3434
String expected = "0";
35-
String result = LargestRectangle.largestRectanglehistogram(heights);
35+
String result = LargestRectangle.largestRectangleHistogram(heights);
3636
assertEquals(expected, result);
3737

3838
// Edge case with a single bar
3939
heights = new int[] {5};
4040
expected = "5";
41-
result = LargestRectangle.largestRectanglehistogram(heights);
41+
result = LargestRectangle.largestRectangleHistogram(heights);
4242
assertEquals(expected, result);
4343

4444
// Edge case with all bars of height 0
4545
heights = new int[] {0, 0, 0};
4646
expected = "0";
47-
result = LargestRectangle.largestRectanglehistogram(heights);
47+
result = LargestRectangle.largestRectangleHistogram(heights);
4848
assertEquals(expected, result);
4949
}
5050

@@ -56,7 +56,7 @@ void testLargestRectangleHistogramWithLargeInput() {
5656
heights[i] = 1;
5757
}
5858
String expected = "10000";
59-
String result = LargestRectangle.largestRectanglehistogram(heights);
59+
String result = LargestRectangle.largestRectangleHistogram(heights);
6060
assertEquals(expected, result);
6161
}
6262

@@ -65,13 +65,13 @@ void testLargestRectangleHistogramWithComplexCases() {
6565
// Complex case with a mix of heights
6666
int[] heights = {6, 2, 5, 4, 5, 1, 6};
6767
String expected = "12";
68-
String result = LargestRectangle.largestRectanglehistogram(heights);
68+
String result = LargestRectangle.largestRectangleHistogram(heights);
6969
assertEquals(expected, result);
7070

7171
// Case with a peak in the middle
7272
heights = new int[] {2, 1, 5, 6, 2, 3, 1};
7373
expected = "10";
74-
result = LargestRectangle.largestRectanglehistogram(heights);
74+
result = LargestRectangle.largestRectangleHistogram(heights);
7575
assertEquals(expected, result);
7676
}
7777
}

0 commit comments

Comments
 (0)