Skip to content

style: enable HideUtilityClassConstructor in checkstyle #5147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
<!-- See https://checkstyle.org/checks/design/index.html -->
<!-- TODO <module name="DesignForExtension"/> -->
<!-- TODO <module name="FinalClass"/> -->
<!-- TODO <module name="HideUtilityClassConstructor"/> -->
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<!-- TODO <module name="VisibilityModifier"/> -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
* Finds all permutations of 1...n of length k
* @author TheClerici (<a href="https://github.com/TheClerici">git-TheClerici</a>)
*/
public class ArrayCombination {
public final class ArrayCombination {
private ArrayCombination() {
}
private static int length;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
* Finds all permutations of given array
* @author Alan Piao (<a href="https://github.com/cpiao3">git-Alan Piao</a>)
*/
public class Combination {
public final class Combination {
private Combination() {
}

private static int length;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
51 46 55 44 53 4 21 12

*/
public class KnightsTour {
public final class KnightsTour {
private KnightsTour() {
}

private static final int BASE = 12;
private static final int[][] MOVES = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class Node {
Set<Integer> edges = new HashSet<Integer>();
}

public class MColoring {
public final class MColoring {
private MColoring() {
}
static int possiblePaint(ArrayList<Node> nodes, int n, int m) {

// Create a visited array of n nodes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.thealgorithms.backtracking;

public class MazeRecursion {
public final class MazeRecursion {
private MazeRecursion() {
}

public static void mazeRecursion() {
// First create a 2 dimensions array to mimic a maze map
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/thealgorithms/backtracking/NQueens.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
* queen is not placed safely. If there is no such way then return an empty list
* as solution
*/
public class NQueens {
public final class NQueens {
private NQueens() {
}

public static void main(String[] args) {
placeQueens(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
* Finds all permutations of given array
* @author Alan Piao (<a href="https://github.com/cpiao3">Git-Alan Piao</a>)
*/
public class Permutation {
public final class Permutation {
private Permutation() {
}

/**
* Find all permutations of given array using backtracking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* @author Bama Charan Chhandogi (https://github.com/BamaCharanChhandogi)
*/

public class IndexOfRightMostSetBit {
public final class IndexOfRightMostSetBit {
private IndexOfRightMostSetBit() {
}
public static int indexOfRightMostSetBit(int n) {
if (n == 0) {
return -1; // No set bits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* @author Bama Charan Chhandogi (https://github.com/BamaCharanChhandogi)
*/

public class IsEven {
public final class IsEven {
private IsEven() {
}
public static boolean isEven(int number) {
return (number & 1) == 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* @author Bama Charan Chhandogi (https://github.com/BamaCharanChhandogi)
*/

public class IsPowerTwo {
public final class IsPowerTwo {
private IsPowerTwo() {
}
public static boolean isPowerTwo(int number) {
if (number <= 0) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* @author Bama Charan Chhandogi (https://github.com/BamaCharanChhandogi)
*/

public class NonRepeatingNumberFinder {
public final class NonRepeatingNumberFinder {
private NonRepeatingNumberFinder() {
}

public static int findNonRepeatingNumber(int[] arr) {
int result = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* @author Bama Charan Chhandogi
*/

public class NumbersDifferentSigns {
public final class NumbersDifferentSigns {
private NumbersDifferentSigns() {
}

public static boolean differentSigns(int num1, int num2) {
return (num1 ^ num2) < 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* @author Bama Charan Chhandogi
*/

public class ReverseBits {
public final class ReverseBits {
private ReverseBits() {
}

public static int reverseBits(int n) {
int result = 0;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/thealgorithms/ciphers/AES.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
* This class is build to demonstrate the application of the AES-algorithm on a
* single 128-Bit block of data.
*/
public class AES {
public final class AES {
private AES() {
}

/**
* Precalculated values for x to the power of 2 in Rijndaels galois field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
* hence in the following program we display it in hexadecimal format of the
* underlying bytes.
*/
public class AESEncryption {
public final class AESEncryption {
private AESEncryption() {
}

private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
private static Cipher aesCipher;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/thealgorithms/ciphers/AffineCipher.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.thealgorithms.ciphers;

class AffineCipher {
final class AffineCipher {
private AffineCipher() {
}

// Key values of a and b
static int a = 17;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*
* @author <a href="https://github.com/freitzzz">freitzzz</a>
*/
public class ColumnarTranspositionCipher {
public final class ColumnarTranspositionCipher {
private ColumnarTranspositionCipher() {
}

private static String keyword;
private static Object[][] table;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/thealgorithms/ciphers/HillCipher.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
* for encryption. The cipher key and plaintext/ciphertext are user inputs.
* @author Ojasva Jain
*/
public class HillCipher {
public final class HillCipher {
private HillCipher() {
}

static Scanner userInput = new Scanner(System.in);

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/thealgorithms/ciphers/Polybius.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* @author Hikmet ÇAKIR
* @since 08-07-2022+03:00
*/
public class Polybius {
public final class Polybius {
private Polybius() {
}

private static final char[][] KEY = {
// 0 1 2 3 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.util.Scanner;

class ProductCipher {
final class ProductCipher {
private ProductCipher() {
}

public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/thealgorithms/ciphers/a5/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

import java.util.BitSet;

public class Utils {
public final class Utils {
private Utils() {
}

public static boolean increment(BitSet bits, int size) {
int i = size - 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* @author Michael Rolland
* @version 2017.10.10
*/
public class AnyBaseToAnyBase {
public final class AnyBaseToAnyBase {
private AnyBaseToAnyBase() {
}

/**
* Smallest and largest base you want to accept as valid input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* @author Varun Upadhyay (<a href="https://github.com/varunu28">...</a>)
*/
// Driver program
public class AnyBaseToDecimal {
public final class AnyBaseToDecimal {
private AnyBaseToDecimal() {
}

public static void main(String[] args) {
assert convertToDecimal("1010", 2) == Integer.valueOf("1010", 2);
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/thealgorithms/conversions/AnytoAny.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
// number.
// sn ,sb,db ---> ()dn . this is what we have to do .

public class AnytoAny {
public final class AnytoAny {
private AnytoAny() {
}

public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
/**
* This class converts a Binary number to a Decimal number
*/
class BinaryToDecimal {
final class BinaryToDecimal {
private BinaryToDecimal() {
}

public static long binaryToDecimal(long binNum) {
long binCopy, d, s = 0, power = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
*
* @author Nishita Aggarwal
*/
public class BinaryToHexadecimal {
public final class BinaryToHexadecimal {
private BinaryToHexadecimal() {
}

/**
* This method converts a binary number to a hexadecimal number.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*
* @author Zachary Jones
*/
public class BinaryToOctal {
public final class BinaryToOctal {
private BinaryToOctal() {
}

/**
* Main method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
* @author Varun Upadhyay (<a href="https://github.com/varunu28">...</a>)
*/
// Driver Program
public class DecimalToAnyBase {
public final class DecimalToAnyBase {
private DecimalToAnyBase() {
}

public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
/**
* This class converts a Decimal number to a Binary number
*/
class DecimalToBinary {
final class DecimalToBinary {
private DecimalToBinary() {
}

/**
* Main Method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.thealgorithms.conversions;

// hex = [0 - 9] -> [A - F]
class DecimalToHexaDecimal {
final class DecimalToHexaDecimal {
private DecimalToHexaDecimal() {
}

private static final int SIZE_OF_INT_IN_HALF_BYTES = 8;
private static final int NUMBER_OF_BITS_IN_HALF_BYTE = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
/**
* This class converts Decimal numbers to Octal Numbers
*/
public class DecimalToOctal {
public final class DecimalToOctal {
private DecimalToOctal() {
}

/**
* Main Method
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/thealgorithms/conversions/HexToOct.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*
* @author Tanmay Joshi
*/
public class HexToOct {
public final class HexToOct {
private HexToOct() {
}

/**
* This method converts a Hexadecimal number to a decimal number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.util.Scanner;

public class HexaDecimalToDecimal {
public final class HexaDecimalToDecimal {
private HexaDecimalToDecimal() {
}

// convert hexadecimal to decimal
public static int getHexaToDec(String hex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
* ('I', 1); ('IV',4); ('V', 5); ('IX',9); ('X', 10); ('XL',40); ('L', 50);
* ('XC',90); ('C', 100); ('D', 500); ('M', 1000);
*/
public class IntegerToRoman {
public final class IntegerToRoman {
private IntegerToRoman() {
}

private static final int[] ALL_ROMAN_NUMBERS_IN_ARABIC = new int[] {
1000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
* @author Bama Charan Chhandogi
*/

public class OctalToBinary {
public final class OctalToBinary {
private OctalToBinary() {
}
public static long convertOctalToBinary(int octalNumber) {
long binaryNumber = 0;
int digitPosition = 1;
Expand Down
Loading