Skip to content

Commit a710fe1

Browse files
authored
style: include SPP_USE_ISEMPTY (#5238)
1 parent 22f2abd commit a710fe1

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

spotbugs-exclude.xml

-3
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@
132132
<Match>
133133
<Bug pattern="USBR_UNNECESSARY_STORE_BEFORE_RETURN" />
134134
</Match>
135-
<Match>
136-
<Bug pattern="SPP_USE_ISEMPTY" />
137-
</Match>
138135
<Match>
139136
<Bug pattern="BL_BURYING_LOGIC" />
140137
</Match>

src/main/java/com/thealgorithms/devutils/nodes/LargeTreeNode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public LargeTreeNode(E data, LargeTreeNode<E> parentNode, Collection<LargeTreeNo
6464
*/
6565
@Override
6666
public boolean isLeafNode() {
67-
return (childNodes == null || childNodes.size() == 0);
67+
return (childNodes == null || childNodes.isEmpty());
6868
}
6969

7070
public Collection<LargeTreeNode<E>> getChildNodes() {

src/main/java/com/thealgorithms/searches/QuickSelect.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private QuickSelect() {
3131
public static <T extends Comparable<T>> T select(List<T> list, int n) {
3232
Objects.requireNonNull(list, "The list of elements must not be null.");
3333

34-
if (list.size() == 0) {
34+
if (list.isEmpty()) {
3535
String msg = "The list of elements must not be empty.";
3636
throw new IllegalArgumentException(msg);
3737
}

src/main/java/com/thealgorithms/sorts/MergeSortRecursive.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ private static List<Integer> merge(List<Integer> arr) {
3434
}
3535

3636
private static List<Integer> sort(List<Integer> unsortedA, List<Integer> unsortedB) {
37-
if (unsortedA.size() <= 0 && unsortedB.size() <= 0) {
37+
if (unsortedA.isEmpty() && unsortedB.isEmpty()) {
3838
return new ArrayList<>();
3939
}
40-
if (unsortedA.size() <= 0) {
40+
if (unsortedA.isEmpty()) {
4141
return unsortedB;
4242
}
43-
if (unsortedB.size() <= 0) {
43+
if (unsortedB.isEmpty()) {
4444
return unsortedA;
4545
}
4646
if (unsortedA.get(0) <= unsortedB.get(0)) {

0 commit comments

Comments
 (0)