style: enable HideUtilityClassConstructor in checkstyle (#5147)

This commit is contained in:
Piotr Idzik
2024-05-08 08:58:29 +02:00
committed by GitHub
parent 030bb91d05
commit d3bb691f59
285 changed files with 895 additions and 339 deletions

View File

@ -5,7 +5,9 @@ package com.thealgorithms.strings;
* based on the position of the characters in the conventional ordering of an
* alphabet. Wikipedia: https://en.wikipedia.org/wiki/Alphabetical_order
*/
class Alphabetical {
final class Alphabetical {
private Alphabetical() {
}
public static void main(String[] args) {
assert !isAlphabetical("123abc");

View File

@ -1,6 +1,8 @@
package com.thealgorithms.strings;
public class CharactersSame {
public final class CharactersSame {
private CharactersSame() {
}
/**
* Driver Code

View File

@ -7,7 +7,9 @@ import java.util.Map;
* Two strings are anagrams if they are made of the same letters arranged
* differently (ignoring the case).
*/
public class CheckAnagrams {
public final class CheckAnagrams {
private CheckAnagrams() {
}
/**
* Check if two strings are anagrams or not
*

View File

@ -9,7 +9,9 @@ import java.util.Set;
* on the position of the characters in the conventional ordering of an
* alphabet. Wikipedia: https://en.wikipedia.org/wiki/Alphabetical_order
*/
public class CheckVowels {
public final class CheckVowels {
private CheckVowels() {
}
private static final Set<Character> VOWELS = new HashSet<>(Arrays.asList('a', 'e', 'i', 'o', 'u'));

View File

@ -4,7 +4,9 @@ package com.thealgorithms.strings;
is the number of positions at which the corresponding symbols are different.
https://en.wikipedia.org/wiki/Hamming_distance
*/
public class HammingDistance {
public final class HammingDistance {
private HammingDistance() {
}
/**
* calculate the hamming distance between two strings of equal length

View File

@ -44,7 +44,9 @@ import java.util.HashMap;
* recommend checking out the wikipedia page and professor Anany Levitin's book:
* Introduction To The Design And Analysis Of Algorithms.
*/
public class HorspoolSearch {
public final class HorspoolSearch {
private HorspoolSearch() {
}
private static HashMap<Character, Integer> shiftValues; // bad symbol table
private static Integer patternLength;

View File

@ -5,7 +5,9 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class Isomorphic {
public final class Isomorphic {
private Isomorphic() {
}
public static boolean checkStrings(String s, String t) {
if (s.length() != t.length()) {

View File

@ -4,7 +4,9 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class LetterCombinationsOfPhoneNumber {
public final class LetterCombinationsOfPhoneNumber {
private LetterCombinationsOfPhoneNumber() {
}
static Character[][] numberToCharMap;

View File

@ -3,7 +3,9 @@ package com.thealgorithms.strings;
// Longest Palindromic Substring
import java.util.Scanner;
class LongestPalindromicSubstring {
final class LongestPalindromicSubstring {
private LongestPalindromicSubstring() {
}
public static void main(String[] args) {
Solution s = new Solution();

View File

@ -1,6 +1,8 @@
package com.thealgorithms.strings;
public class Lower {
public final class Lower {
private Lower() {
}
/**
* Driver Code

View File

@ -3,7 +3,9 @@
package com.thealgorithms.strings;
public class MyAtoi {
public final class MyAtoi {
private MyAtoi() {
}
public static int myAtoi(String s) {
s = s.trim();
char[] char_1 = s.toCharArray();

View File

@ -3,7 +3,9 @@ package com.thealgorithms.strings;
/**
* Wikipedia: https://en.wikipedia.org/wiki/Palindrome
*/
class Palindrome {
final class Palindrome {
private Palindrome() {
}
/**
* Check if a string is palindrome string or not using String Builder

View File

@ -5,7 +5,9 @@ import java.util.HashSet;
/**
* Wikipedia: https://en.wikipedia.org/wiki/Pangram
*/
public class Pangram {
public final class Pangram {
private Pangram() {
}
/**
* Test code

View File

@ -11,7 +11,9 @@ Backtracking algorithm used in the program:-
again, and we backtrack to the previous position and swap B with C. So, now we got ABC and ACB.
>>Repeat these steps for BAC and CBA, to get all the permutations.
*/
public class PermuteString {
public final class PermuteString {
private PermuteString() {
}
// Function for swapping the characters at position I with character at position j
public static String swapString(String a, int i, int j) {

View File

@ -3,7 +3,9 @@ package com.thealgorithms.strings;
/**
* Reverse String using different version
*/
public class ReverseString {
public final class ReverseString {
private ReverseString() {
}
public static void main(String[] args) {
assert reverse("abc123").equals("321cba");

View File

@ -4,7 +4,9 @@ package com.thealgorithms.strings;
* Reverse String using Recursion
*/
public class ReverseStringRecursive {
public final class ReverseStringRecursive {
private ReverseStringRecursive() {
}
/**
* @param str string to be reversed
* @return reversed string

View File

@ -6,7 +6,9 @@ package com.thealgorithms.strings;
* the string "abcdef" to the end of the string, so that the original string
* becomes the string "cdefab"
*/
public class Rotation {
public final class Rotation {
private Rotation() {
}
public static void main(String[] args) {
assert rotation("abcdef", 2).equals("cdefab");

View File

@ -4,7 +4,9 @@ package com.thealgorithms.strings;
* string
* @author Swarga-codes (https://github.com/Swarga-codes)
*/
public class StringCompression {
public final class StringCompression {
private StringCompression() {
}
/**
* Returns the compressed or encoded string
*

View File

@ -1,6 +1,8 @@
package com.thealgorithms.strings;
public class Upper {
public final class Upper {
private Upper() {
}
/**
* Driver Code

View File

@ -4,7 +4,9 @@ package com.thealgorithms.strings;
// the same type of brackets. Open brackets must be closed in the correct order. Every close
// bracket has a corresponding open bracket of the same type.
public class ValidParentheses {
public final class ValidParentheses {
private ValidParentheses() {
}
public static boolean isValid(String s) {
char[] stack = new char[s.length()];
int head = 0;

View File

@ -38,7 +38,9 @@ import java.util.Queue;
All the words in wordList are unique.
*/
class WordLadder {
final class WordLadder {
private WordLadder() {
}
/**
* This function finds the ladderLength

View File

@ -2,7 +2,9 @@ package com.thealgorithms.strings;
import java.util.HashMap;
class longestNonRepeativeSubstring {
final class longestNonRepeativeSubstring {
private longestNonRepeativeSubstring() {
}
public static int lengthOfLongestSubstring(String s) {
int max = 0, start = 0, i = 0;

View File

@ -1,6 +1,8 @@
package com.thealgorithms.strings.zigZagPattern;
class zigZagPattern {
final class zigZagPattern {
private zigZagPattern() {
}
public static String encode(String s, int numRows) {
if (numRows < 2 || s.length() < numRows) return s;