style: include SPP_USE_ISEMPTY (#5238)

This commit is contained in:
Piotr Idzik 2024-06-24 10:49:50 +02:00 committed by GitHub
parent 22f2abd94f
commit a710fe11c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 8 deletions

View File

@ -132,9 +132,6 @@
<Match> <Match>
<Bug pattern="USBR_UNNECESSARY_STORE_BEFORE_RETURN" /> <Bug pattern="USBR_UNNECESSARY_STORE_BEFORE_RETURN" />
</Match> </Match>
<Match>
<Bug pattern="SPP_USE_ISEMPTY" />
</Match>
<Match> <Match>
<Bug pattern="BL_BURYING_LOGIC" /> <Bug pattern="BL_BURYING_LOGIC" />
</Match> </Match>

View File

@ -64,7 +64,7 @@ public class LargeTreeNode<E> extends TreeNode<E> {
*/ */
@Override @Override
public boolean isLeafNode() { public boolean isLeafNode() {
return (childNodes == null || childNodes.size() == 0); return (childNodes == null || childNodes.isEmpty());
} }
public Collection<LargeTreeNode<E>> getChildNodes() { public Collection<LargeTreeNode<E>> getChildNodes() {

View File

@ -31,7 +31,7 @@ public final class QuickSelect {
public static <T extends Comparable<T>> T select(List<T> list, int n) { public static <T extends Comparable<T>> T select(List<T> list, int n) {
Objects.requireNonNull(list, "The list of elements must not be null."); Objects.requireNonNull(list, "The list of elements must not be null.");
if (list.size() == 0) { if (list.isEmpty()) {
String msg = "The list of elements must not be empty."; String msg = "The list of elements must not be empty.";
throw new IllegalArgumentException(msg); throw new IllegalArgumentException(msg);
} }

View File

@ -34,13 +34,13 @@ public class MergeSortRecursive {
} }
private static List<Integer> sort(List<Integer> unsortedA, List<Integer> unsortedB) { private static List<Integer> sort(List<Integer> unsortedA, List<Integer> unsortedB) {
if (unsortedA.size() <= 0 && unsortedB.size() <= 0) { if (unsortedA.isEmpty() && unsortedB.isEmpty()) {
return new ArrayList<>(); return new ArrayList<>();
} }
if (unsortedA.size() <= 0) { if (unsortedA.isEmpty()) {
return unsortedB; return unsortedB;
} }
if (unsortedB.size() <= 0) { if (unsortedB.isEmpty()) {
return unsortedA; return unsortedA;
} }
if (unsortedA.get(0) <= unsortedB.get(0)) { if (unsortedA.get(0) <= unsortedB.get(0)) {