diff --git a/checkstyle.xml b/checkstyle.xml index 5bbc5d72..912a6b24 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -174,7 +174,7 @@ - + diff --git a/src/main/java/com/thealgorithms/datastructures/bags/Bag.java b/src/main/java/com/thealgorithms/datastructures/bags/Bag.java index 66da3d34..ff5c832b 100644 --- a/src/main/java/com/thealgorithms/datastructures/bags/Bag.java +++ b/src/main/java/com/thealgorithms/datastructures/bags/Bag.java @@ -13,7 +13,7 @@ public class Bag implements Iterable { private Node firstElement; // first element of the bag private int size; // size of bag - private static class Node { + private static final class Node { private Element content; private Node nextElement; diff --git a/src/main/java/com/thealgorithms/datastructures/dynamicarray/DynamicArray.java b/src/main/java/com/thealgorithms/datastructures/dynamicarray/DynamicArray.java index e1697f44..186f301f 100644 --- a/src/main/java/com/thealgorithms/datastructures/dynamicarray/DynamicArray.java +++ b/src/main/java/com/thealgorithms/datastructures/dynamicarray/DynamicArray.java @@ -153,7 +153,7 @@ public class DynamicArray implements Iterable { return new DynamicArrayIterator(); } - private class DynamicArrayIterator implements Iterator { + private final class DynamicArrayIterator implements Iterator { private int cursor; diff --git a/src/main/java/com/thealgorithms/datastructures/graphs/WelshPowell.java b/src/main/java/com/thealgorithms/datastructures/graphs/WelshPowell.java index 3b823f02..0981638d 100644 --- a/src/main/java/com/thealgorithms/datastructures/graphs/WelshPowell.java +++ b/src/main/java/com/thealgorithms/datastructures/graphs/WelshPowell.java @@ -17,7 +17,7 @@ public final class WelshPowell { private WelshPowell() { } - static class Graph { + static final class Graph { private HashSet[] adjacencyLists; private Graph(int vertices) { diff --git a/src/main/java/com/thealgorithms/datastructures/hashmap/hashing/Intersection.java b/src/main/java/com/thealgorithms/datastructures/hashmap/hashing/Intersection.java index ad3f617c..54bd10de 100644 --- a/src/main/java/com/thealgorithms/datastructures/hashmap/hashing/Intersection.java +++ b/src/main/java/com/thealgorithms/datastructures/hashmap/hashing/Intersection.java @@ -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 intersection(int[] arr1, int[] arr2) { if (arr1 == null || arr2 == null || arr1.length == 0 || arr2.length == 0) { diff --git a/src/main/java/com/thealgorithms/datastructures/heaps/LeftistHeap.java b/src/main/java/com/thealgorithms/datastructures/heaps/LeftistHeap.java index cfec2b3c..0e4bcc2c 100644 --- a/src/main/java/com/thealgorithms/datastructures/heaps/LeftistHeap.java +++ b/src/main/java/com/thealgorithms/datastructures/heaps/LeftistHeap.java @@ -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; diff --git a/src/main/java/com/thealgorithms/datastructures/lists/CircleLinkedList.java b/src/main/java/com/thealgorithms/datastructures/lists/CircleLinkedList.java index c42b1045..6eb9d75f 100644 --- a/src/main/java/com/thealgorithms/datastructures/lists/CircleLinkedList.java +++ b/src/main/java/com/thealgorithms/datastructures/lists/CircleLinkedList.java @@ -2,7 +2,7 @@ package com.thealgorithms.datastructures.lists; public class CircleLinkedList { - private static class Node { + private static final class Node { Node next; E value; diff --git a/src/main/java/com/thealgorithms/datastructures/lists/Merge_K_SortedLinkedlist.java b/src/main/java/com/thealgorithms/datastructures/lists/Merge_K_SortedLinkedlist.java index 7206ccec..d98335b1 100644 --- a/src/main/java/com/thealgorithms/datastructures/lists/Merge_K_SortedLinkedlist.java +++ b/src/main/java/com/thealgorithms/datastructures/lists/Merge_K_SortedLinkedlist.java @@ -43,7 +43,7 @@ public class Merge_K_SortedLinkedlist { return head; } - private class Node { + private final class Node { private int data; private Node next; diff --git a/src/main/java/com/thealgorithms/datastructures/trees/GenericTree.java b/src/main/java/com/thealgorithms/datastructures/trees/GenericTree.java index d3484678..39af10ba 100644 --- a/src/main/java/com/thealgorithms/datastructures/trees/GenericTree.java +++ b/src/main/java/com/thealgorithms/datastructures/trees/GenericTree.java @@ -16,7 +16,7 @@ import java.util.Scanner; */ public class GenericTree { - private static class Node { + private static final class Node { int data; ArrayList child = new ArrayList<>(); diff --git a/src/main/java/com/thealgorithms/datastructures/trees/TreeRandomNode.java b/src/main/java/com/thealgorithms/datastructures/trees/TreeRandomNode.java index eeb253d9..b1123a22 100644 --- a/src/main/java/com/thealgorithms/datastructures/trees/TreeRandomNode.java +++ b/src/main/java/com/thealgorithms/datastructures/trees/TreeRandomNode.java @@ -26,7 +26,7 @@ import java.util.ArrayList; public class TreeRandomNode { - private class Node { + private final class Node { int item; Node left, right; diff --git a/src/main/java/com/thealgorithms/geometry/GrahamScan.java b/src/main/java/com/thealgorithms/geometry/GrahamScan.java index 9122c6f6..4f4aebae 100644 --- a/src/main/java/com/thealgorithms/geometry/GrahamScan.java +++ b/src/main/java/com/thealgorithms/geometry/GrahamScan.java @@ -126,7 +126,7 @@ public class GrahamScan { return new PolarOrder(); } - private class PolarOrder implements Comparator { + private final class PolarOrder implements Comparator { public int compare(Point p1, Point p2) { int dx1 = p1.x - x; int dy1 = p1.y - y; diff --git a/src/main/java/com/thealgorithms/others/RotateMatrixBy90Degrees.java b/src/main/java/com/thealgorithms/others/RotateMatrixBy90Degrees.java index 081b0d16..985b8b26 100644 --- a/src/main/java/com/thealgorithms/others/RotateMatrixBy90Degrees.java +++ b/src/main/java/com/thealgorithms/others/RotateMatrixBy90Degrees.java @@ -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() { }