Skip to content

Commit 5af136e

Browse files
committed
Suggest replacing size() == 0 with isEmpty() for collection check
Consider using isEmpty() instead of size() == 0 to improve code readability and follow modern Java practices. Signed-off-by: 2-say <dev2say@gmail.com>
1 parent 7b8ff72 commit 5af136e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/main/java/org/springframework/security/core/ComparableVersion.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ public int getType() {
414414

415415
@Override
416416
public boolean isNull() {
417-
return (size() == 0);
417+
return isEmpty();
418418
}
419419

420420
void normalize() {
@@ -434,7 +434,7 @@ else if (!(lastItem instanceof ListItem)) {
434434
@Override
435435
public int compareTo(Item item) {
436436
if (item == null) {
437-
if (size() == 0) {
437+
if (isEmpty()) {
438438
return 0; // 1-0 = 1- (normalize) = 1
439439
}
440440
Item first = get(0);

0 commit comments

Comments
 (0)