Skip to content

Commit 785cd10

Browse files
Add private constructor to HuffmanCoding
Prevent instantiation of HuffmanCoding class.
1 parent 5c5819a commit 785cd10

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ public class HuffmanCoding {
2121

2222
private static Map<Character, String> huffmanCodes = new HashMap<>();
2323
private static HuffmanNode root;
24-
24+
25+
private HuffmanCoding() {
26+
throw new UnsupportedOperationException("Utility class");
27+
}
2528
/**
2629
* Builds the Huffman Tree and generates codes.
2730
* @param text The input string to be encoded.

0 commit comments

Comments
 (0)