Skip to content

Commit

Permalink
Merge pull request alibaba#185
Browse files Browse the repository at this point in the history
optimize size() method to isEmpty()
  • Loading branch information
oldratlee authored Mar 25, 2021
2 parents 6d6149b + c842718 commit 14c94b2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void setData(Collection<T> data) {
}

public boolean isEmpty() {
return data == null || data.size() == 0;
return data == null || data.isEmpty();
}

public boolean isNotEmpty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public int getTotalPages() {
}

public boolean isEmpty() {
return data == null || data.size() == 0;
return data == null || data.isEmpty();
}

public boolean isNotEmpty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ public static void notNull(Object object) {
}

public static void notEmpty(Collection<?> collection, String errorCode, String errMessage) {
if (collection == null || collection.size() <= 0) {
if (collection == null || collection.isEmpty()) {
throw new BizException(errorCode, errMessage);
}
}

public static void notEmpty(Collection<?> collection, String errMessage) {
if (collection == null || collection.size() <= 0) {
if (collection == null || collection.isEmpty()) {
throw new BizException(errMessage);
}
}
Expand Down

0 comments on commit 14c94b2

Please sign in to comment.