style: enable FinalClass in checkstyle (#5154)

This commit is contained in:
Godwill Christopher 2024-05-11 00:50:05 -06:00 committed by GitHub
parent 52f15b2b08
commit bbe4a025df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 12 additions and 12 deletions

View File

@ -174,7 +174,7 @@
<!-- Checks for class design -->
<!-- See https://checkstyle.org/checks/design/index.html -->
<!-- TODO <module name="DesignForExtension"/> -->
<!-- TODO <module name="FinalClass"/> -->
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<!-- TODO <module name="VisibilityModifier"/> -->

View File

@ -13,7 +13,7 @@ public class Bag<Element> implements Iterable<Element> {
private Node<Element> firstElement; // first element of the bag
private int size; // size of bag
private static class Node<Element> {
private static final class Node<Element> {
private Element content;
private Node<Element> nextElement;

View File

@ -153,7 +153,7 @@ public class DynamicArray<E> implements Iterable<E> {
return new DynamicArrayIterator();
}
private class DynamicArrayIterator implements Iterator<E> {
private final class DynamicArrayIterator implements Iterator<E> {
private int cursor;

View File

@ -17,7 +17,7 @@ public final class WelshPowell {
private WelshPowell() {
}
static class Graph {
static final class Graph {
private HashSet<Integer>[] adjacencyLists;
private Graph(int vertices) {

View File

@ -12,7 +12,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Intersection {
public final class Intersection {
public static List<Integer> intersection(int[] arr1, int[] arr2) {
if (arr1 == null || arr2 == null || arr1.length == 0 || arr2.length == 0) {

View File

@ -13,7 +13,7 @@ import java.util.ArrayList;
*/
public class LeftistHeap {
private class Node {
private final class Node {
private int element, npl;
private Node left, right;

View File

@ -2,7 +2,7 @@ package com.thealgorithms.datastructures.lists;
public class CircleLinkedList<E> {
private static class Node<E> {
private static final class Node<E> {
Node<E> next;
E value;

View File

@ -43,7 +43,7 @@ public class Merge_K_SortedLinkedlist {
return head;
}
private class Node {
private final class Node {
private int data;
private Node next;

View File

@ -16,7 +16,7 @@ import java.util.Scanner;
*/
public class GenericTree {
private static class Node {
private static final class Node {
int data;
ArrayList<Node> child = new ArrayList<>();

View File

@ -26,7 +26,7 @@ import java.util.ArrayList;
public class TreeRandomNode {
private class Node {
private final class Node {
int item;
Node left, right;

View File

@ -126,7 +126,7 @@ public class GrahamScan {
return new PolarOrder();
}
private class PolarOrder implements Comparator<Point> {
private final class PolarOrder implements Comparator<Point> {
public int compare(Point p1, Point p2) {
int dx1 = p1.x - x;
int dy1 = p1.y - y;

View File

@ -6,7 +6,7 @@ package com.thealgorithms.others;
*/
import java.util.Scanner;
class Rotate_by_90_degrees {
final class Rotate_by_90_degrees {
private Rotate_by_90_degrees() {
}