Skip to content

Commit b3903f5

Browse files
authored
style: enable RedundantModifier in checkstyle (#5140)
1 parent 1e2d7e9 commit b3903f5

38 files changed

+59
-59
lines changed

checkstyle.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
<!-- Modifier Checks -->
149149
<!-- See https://checkstyle.org/checks/modifier/index.html -->
150150
<module name="ModifierOrder"/>
151-
<!-- TODO <module name="RedundantModifier"/> -->
151+
<module name="RedundantModifier"/>
152152

153153
<!-- Checks for blocks. You know, those {}'s -->
154154
<!-- See https://checkstyle.org/checks/blocks/index.html -->

src/main/java/com/thealgorithms/datastructures/bags/Bag.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private class ListIterator<Element> implements Iterator<Element> {
8080

8181
private Node<Element> currentElement;
8282

83-
public ListIterator(Node<Element> firstElement) {
83+
ListIterator(Node<Element> firstElement) {
8484
currentElement = firstElement;
8585
}
8686

src/main/java/com/thealgorithms/datastructures/bloomfilter/BloomFilter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private class Hash<T> {
4242

4343
int index;
4444

45-
public Hash(int index) {
45+
Hash(int index) {
4646
this.index = index;
4747
}
4848

src/main/java/com/thealgorithms/datastructures/buffers/CircularBuffer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private static class CircularPointer {
4343
private int pointer;
4444
private final int max;
4545

46-
public CircularPointer(int pointer, int max) {
46+
CircularPointer(int pointer, int max) {
4747
this.pointer = pointer;
4848
this.max = max;
4949
}

src/main/java/com/thealgorithms/datastructures/caches/LFUCache.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private class Node {
1717
private Node previous;
1818
private Node next;
1919

20-
public Node(K key, V value, int frequency) {
20+
Node(K key, V value, int frequency) {
2121
this.key = key;
2222
this.value = value;
2323
this.frequency = frequency;

src/main/java/com/thealgorithms/datastructures/caches/LRUCache.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ static final class Entry<I, J> {
126126
private I key;
127127
private J value;
128128

129-
public Entry() {
129+
Entry() {
130130
}
131131

132-
public Entry(Entry<I, J> preEntry, Entry<I, J> nextEntry, I key, J value) {
132+
Entry(Entry<I, J> preEntry, Entry<I, J> nextEntry, I key, J value) {
133133
this.preEntry = preEntry;
134134
this.nextEntry = nextEntry;
135135
this.key = key;

src/main/java/com/thealgorithms/datastructures/caches/MRUCache.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ static final class Entry<I, J> {
124124
private I key;
125125
private J value;
126126

127-
public Entry() {
127+
Entry() {
128128
}
129129

130-
public Entry(Entry<I, J> preEntry, Entry<I, J> nextEntry, I key, J value) {
130+
Entry(Entry<I, J> preEntry, Entry<I, J> nextEntry, I key, J value) {
131131
this.preEntry = preEntry;
132132
this.nextEntry = nextEntry;
133133
this.key = key;

src/main/java/com/thealgorithms/datastructures/crdt/GCounter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class GCounter {
2626
*
2727
* @param n The number of nodes in the cluster.
2828
*/
29-
public GCounter(int myId, int n) {
29+
GCounter(int myId, int n) {
3030
this.myId = myId;
3131
this.n = n;
3232
this.P = new HashMap<>();

src/main/java/com/thealgorithms/datastructures/crdt/LWWElementSet.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Element {
2626
* @param timestamp The timestamp associated with the element.
2727
* @param bias The bias of the element (ADDS or REMOVALS).
2828
*/
29-
public Element(String key, int timestamp, Bias bias) {
29+
Element(String key, int timestamp, Bias bias) {
3030
this.key = key;
3131
this.timestamp = timestamp;
3232
this.bias = bias;
@@ -49,7 +49,7 @@ class LWWElementSet {
4949
/**
5050
* Constructs an empty LWWElementSet.
5151
*/
52-
public LWWElementSet() {
52+
LWWElementSet() {
5353
this.addSet = new HashMap<>();
5454
this.removeSet = new HashMap<>();
5555
}

src/main/java/com/thealgorithms/datastructures/crdt/PNCounter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PNCounter {
2828
* @param myId The identifier of the current node.
2929
* @param n The number of nodes in the cluster.
3030
*/
31-
public PNCounter(int myId, int n) {
31+
PNCounter(int myId, int n) {
3232
this.myId = myId;
3333
this.n = n;
3434
this.P = new HashMap<>();

src/main/java/com/thealgorithms/datastructures/graphs/A_Star.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ private static class Graph {
1414
private ArrayList<ArrayList<Edge>> graph;
1515

1616
// Initialise ArrayLists in Constructor
17-
public Graph(int size) {
17+
Graph(int size) {
1818
this.graph = new ArrayList<>();
1919
for (int i = 0; i < size; i++) {
2020
this.graph.add(new ArrayList<>());
@@ -38,7 +38,7 @@ private static class Edge {
3838
private int to;
3939
private int weight;
4040

41-
public Edge(int from, int to, int weight) {
41+
Edge(int from, int to, int weight) {
4242
this.from = from;
4343
this.to = to;
4444
this.weight = weight;
@@ -64,7 +64,7 @@ private static class PathAndDistance {
6464
private ArrayList<Integer> path; // list of visited nodes in this path.
6565
private int estimated; // heuristic value associated to the last node od the path (current node).
6666

67-
public PathAndDistance(int distance, ArrayList<Integer> path, int estimated) {
67+
PathAndDistance(int distance, ArrayList<Integer> path, int estimated) {
6868
this.distance = distance;
6969
this.path = path;
7070
this.estimated = estimated;

src/main/java/com/thealgorithms/datastructures/graphs/BellmanFord.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Edge {
3131
* @param v End vertex
3232
* @param c Weight
3333
*/
34-
public Edge(int a, int b, int c) {
34+
Edge(int a, int b, int c) {
3535
u = a;
3636
v = b;
3737
w = c;

src/main/java/com/thealgorithms/datastructures/graphs/ConnectedComponent.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Node {
1515

1616
E name;
1717

18-
public Node(E name) {
18+
Node(E name) {
1919
this.name = name;
2020
}
2121
}
@@ -24,7 +24,7 @@ class Edge {
2424

2525
Node startNode, endNode;
2626

27-
public Edge(Node startNode, Node endNode) {
27+
Edge(Node startNode, Node endNode) {
2828
this.startNode = startNode;
2929
this.endNode = endNode;
3030
}
@@ -33,7 +33,7 @@ public Edge(Node startNode, Node endNode) {
3333
ArrayList<Edge> edgeList;
3434
ArrayList<Node> nodeList;
3535

36-
public Graph() {
36+
Graph() {
3737
edgeList = new ArrayList<Edge>();
3838
nodeList = new ArrayList<Node>();
3939
}

src/main/java/com/thealgorithms/datastructures/graphs/Cycles.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Cycle {
1010
private boolean[] visited;
1111
ArrayList<ArrayList<Integer>> cycles = new ArrayList<ArrayList<Integer>>();
1212

13-
public Cycle() {
13+
Cycle() {
1414
Scanner in = new Scanner(System.in);
1515
System.out.print("Enter the no. of nodes: ");
1616
nodes = in.nextInt();

src/main/java/com/thealgorithms/datastructures/graphs/Graphs.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class AdjacencyListGraph<E extends Comparable<E>> {
66

77
ArrayList<Vertex> vertices;
88

9-
public AdjacencyListGraph() {
9+
AdjacencyListGraph() {
1010
vertices = new ArrayList<>();
1111
}
1212

@@ -15,7 +15,7 @@ private class Vertex {
1515
E data;
1616
ArrayList<Vertex> adjacentVertices;
1717

18-
public Vertex(E data) {
18+
Vertex(E data) {
1919
adjacentVertices = new ArrayList<>();
2020
this.data = data;
2121
}

src/main/java/com/thealgorithms/datastructures/graphs/Kruskal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private static class Edge {
2323
private int to;
2424
private int weight;
2525

26-
public Edge(int from, int to, int weight) {
26+
Edge(int from, int to, int weight) {
2727
this.from = from;
2828
this.to = to;
2929
this.weight = weight;

src/main/java/com/thealgorithms/datastructures/graphs/MatrixGraphs.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class AdjacencyMatrixGraph {
6868
/**
6969
* Constructor
7070
*/
71-
public AdjacencyMatrixGraph(int givenNumberOfVertices) {
71+
AdjacencyMatrixGraph(int givenNumberOfVertices) {
7272
this.setNumberOfVertices(givenNumberOfVertices);
7373
this.setNumberOfEdges(0);
7474
this.setAdjacency(new int[givenNumberOfVertices][givenNumberOfVertices]);

src/main/java/com/thealgorithms/datastructures/hashmap/hashing/GenericHashMapUsingArrayList.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private class Node {
105105
K key;
106106
V val;
107107

108-
public Node(K key, V val) {
108+
Node(K key, V val) {
109109
this.key = key;
110110
this.val = val;
111111
}

src/main/java/com/thealgorithms/datastructures/lists/DoublyLinkedList.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class Link {
110110
*
111111
* @param value Value of node
112112
*/
113-
public Link(int value) {
113+
Link(int value) {
114114
this.value = value;
115115
}
116116

src/main/java/com/thealgorithms/datastructures/lists/SkipList.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private static class Node<E> {
222222
private final List<Node<E>> backward;
223223

224224
@SuppressWarnings("unchecked")
225-
public Node(E value, int height) {
225+
Node(E value, int height) {
226226
this.value = value;
227227
this.height = height;
228228

src/main/java/com/thealgorithms/datastructures/queues/LinkedQueue.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ static class Node<T> {
1111
T data;
1212
Node<T> next;
1313

14-
public Node() {
14+
Node() {
1515
this(null);
1616
}
1717

18-
public Node(T data) {
18+
Node(T data) {
1919
this(data, null);
2020
}
2121

22-
public Node(T data, Node<T> next) {
22+
Node(T data, Node<T> next) {
2323
this.data = data;
2424
this.next = next;
2525
}

src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class PriorityQueue {
3030
* Default Constructor
3131
*/
3232

33-
public PriorityQueue() {
33+
PriorityQueue() {
3434
/* If capacity is not defined, default size of 11 would be used
3535
* capacity=max+1 because we cant access 0th element of PQ, and to
3636
* accomodate (max)th elements we need capacity to be max+1.
@@ -50,7 +50,7 @@ public PriorityQueue() {
5050
* @param size Size of the queue
5151
*/
5252

53-
public PriorityQueue(int size) {
53+
PriorityQueue(int size) {
5454
maxSize = size + 1;
5555
queueArray = new int[maxSize];
5656
nItems = 0;

src/main/java/com/thealgorithms/datastructures/queues/Queues.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Queue {
3838
/**
3939
* init with DEFAULT_CAPACITY
4040
*/
41-
public Queue() {
41+
Queue() {
4242
this(DEFAULT_CAPACITY);
4343
}
4444

@@ -47,7 +47,7 @@ public Queue() {
4747
*
4848
* @param size Size of the new queue
4949
*/
50-
public Queue(int size) {
50+
Queue(int size) {
5151
maxSize = size;
5252
queueArray = new int[size];
5353
front = 0;

src/main/java/com/thealgorithms/datastructures/stacks/StackOfLinkedList.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Node {
3333
public int data;
3434
public Node next;
3535

36-
public Node(int data) {
36+
Node(int data) {
3737
this.data = data;
3838
this.next = null;
3939
}
@@ -60,7 +60,7 @@ class LinkedListStack {
6060
/**
6161
* Init properties
6262
*/
63-
public LinkedListStack() {
63+
LinkedListStack() {
6464
head = null;
6565
size = 0;
6666
}

src/main/java/com/thealgorithms/datastructures/trees/BinaryTree.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static class Node {
4747
*
4848
* @param value Value to put in the node
4949
*/
50-
public Node(int value) {
50+
Node(int value) {
5151
data = value;
5252
left = null;
5353
right = null;

src/main/java/com/thealgorithms/datastructures/trees/KDTree.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public int getDimension() {
6868
return coordinates.length;
6969
}
7070

71-
public Point(int[] coordinates) {
71+
Point(int[] coordinates) {
7272
this.coordinates = coordinates;
7373
}
7474

src/main/java/com/thealgorithms/datastructures/trees/LazySegmentTree.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static class Node {
1515
private int lazy; // lazied value that should be added to children nodes
1616
Node left, right; // left and right children
1717

18-
public Node(int start, int end, int value) {
18+
Node(int start, int end, int value) {
1919
this.start = start;
2020
this.end = end;
2121
this.value = value;

src/main/java/com/thealgorithms/datastructures/trees/PrintTopViewofTree.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class TreeNode {
1313
TreeNode left, right;
1414

1515
// Constructor
16-
public TreeNode(int key) {
16+
TreeNode(int key) {
1717
this.key = key;
1818
left = right = null;
1919
}
@@ -27,7 +27,7 @@ class QItem {
2727
TreeNode node;
2828
int hd;
2929

30-
public QItem(TreeNode n, int h) {
30+
QItem(TreeNode n, int h) {
3131
node = n;
3232
hd = h;
3333
}
@@ -39,11 +39,11 @@ class Tree {
3939
TreeNode root;
4040

4141
// Constructors
42-
public Tree() {
42+
Tree() {
4343
root = null;
4444
}
4545

46-
public Tree(TreeNode n) {
46+
Tree(TreeNode n) {
4747
root = n;
4848
}
4949

src/main/java/com/thealgorithms/datastructures/trees/nearestRightKey.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ class NRKTree {
5353
public NRKTree right;
5454
public int data;
5555

56-
public NRKTree(int x) {
56+
NRKTree(int x) {
5757
this.left = null;
5858
this.right = null;
5959
this.data = x;
6060
}
6161

62-
public NRKTree(NRKTree right, NRKTree left, int x) {
62+
NRKTree(NRKTree right, NRKTree left, int x) {
6363
this.left = left;
6464
this.right = right;
6565
this.data = x;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public int compareTo(Job otherJob) {
1919
return otherJob.profit - this.profit;
2020
}
2121

22-
public Job(char id, int deadline, int profit) {
22+
Job(char id, int deadline, int profit) {
2323
this.id = id;
2424
this.deadline = deadline;
2525
this.profit = profit;

0 commit comments

Comments
 (0)