Skip to content

Commit 1827482

Browse files
committed
Private constructor to prevent instanciation
1 parent c7d1432 commit 1827482

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/com/thealgorithms/randomized/ClosestPair.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ static double distance(Point p1, Point p2) {
3131
}
3232

3333
public final class ClosestPair {
34+
// Private constructor to prevent instantiation
35+
private ClosestPair() {
36+
throw new AssertionError("Utility class should not be instantiated.");
37+
}
3438

3539
public static double closest(List<Point> points) {
3640
if (points == null || points.isEmpty()) {

0 commit comments

Comments
 (0)