mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-25 05:22:39 +08:00
style: enabled InnerAssignment
in checkstyle (#5162)
* style: enabled InnerAssignment in checkstyle * Refactor code formatting in KnapsackMemoization.java and UnionFind.java * style: remove redundant blank line * style: mark `includeCurrentItem` and `excludeCurrentItem` as `final` * style: remove `KnapsackMemoization` from `pmd-exclude.properties` * style: use `final` --------- Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
This commit is contained in:

committed by
GitHub

parent
f8e62fbb90
commit
0f42e995a4
@ -121,7 +121,8 @@ public class DynamicArray<E> implements Iterable<E> {
|
||||
System.arraycopy(elements, index + 1, elements, index, newSize - index);
|
||||
}
|
||||
|
||||
elements[this.size = newSize] = null;
|
||||
this.size = newSize;
|
||||
this.elements[this.size] = null;
|
||||
}
|
||||
|
||||
private E getElement(final int index) {
|
||||
|
@ -20,7 +20,8 @@ public class LeftistHeap {
|
||||
// Node constructor setting the data element and left/right pointers to null
|
||||
private Node(int element) {
|
||||
this.element = element;
|
||||
left = right = null;
|
||||
left = null;
|
||||
right = null;
|
||||
npl = 0;
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,8 @@ public class CircularQueue {
|
||||
int res = arr[beginningOfQueue];
|
||||
arr[beginningOfQueue] = Integer.MIN_VALUE;
|
||||
if (beginningOfQueue == topOfQueue) {
|
||||
beginningOfQueue = topOfQueue = -1;
|
||||
beginningOfQueue = -1;
|
||||
topOfQueue = -1;
|
||||
} else if (beginningOfQueue + 1 == size) {
|
||||
beginningOfQueue = 0;
|
||||
} else {
|
||||
|
@ -44,7 +44,9 @@ public class LinkedQueue<T> implements Iterable<T> {
|
||||
* Init LinkedQueue
|
||||
*/
|
||||
public LinkedQueue() {
|
||||
front = rear = new Node<>();
|
||||
|
||||
front = new Node<>();
|
||||
rear = front;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,7 +148,8 @@ public class LinkedQueue<T> implements Iterable<T> {
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
return (node = node.next).data;
|
||||
node = node.next;
|
||||
return node.data;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -15,7 +15,8 @@ class TreeNode {
|
||||
// Constructor
|
||||
TreeNode(int key) {
|
||||
this.key = key;
|
||||
left = right = null;
|
||||
left = null;
|
||||
right = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,8 @@ public class RedBlackBST {
|
||||
}
|
||||
|
||||
boolean delete(Node z) {
|
||||
if ((z = findNode(z, root)) == null) {
|
||||
Node result = findNode(z, root);
|
||||
if (result == null) {
|
||||
return false;
|
||||
}
|
||||
Node x;
|
||||
|
Reference in New Issue
Block a user