[
https://issues.apache.org/jira/browse/FINERACT-2627?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Adam Saghy resolved FINERACT-2627.
----------------------------------
Fix Version/s: 1.15.0
Resolution: Fixed
> Use Collection.isEmpty() instead of size() comparison across the codebase
> -------------------------------------------------------------------------
>
> Key: FINERACT-2627
> URL: https://issues.apache.org/jira/browse/FINERACT-2627
> Project: Apache Fineract
> Issue Type: Improvement
> Components: Loan
> Reporter: Berk Emir
> Priority: Minor
> Fix For: 1.15.0
>
>
> SonarCloud rule java:S1155 ("Collection.isEmpty() should be used to test
> for emptiness") flags multiple occurrences across the codebase where
> collection emptiness is checked with `collection.size() > 0` (or `== 0`)
> instead of `!collection.isEmpty()` / `collection.isEmpty()`.
> This ticket started as a cleanup of the 5 occurrences in
> `LoanRepositoryWrapper` (fineract-loan), and is being extended — at the
> maintainer's request (see PR #5945) — to cover the remaining modules
> across the codebase.
> The change is purely a readability/consistency cleanup:
> `!collection.isEmpty()`
> is equivalent to `collection.size() > 0`, so there is no behavioural, API,
> or schema impact. JsonArray checks and index-bound `size()` usages are
> intentionally left untouched.
> Note: the fineract-savings module is covered separately in FINERACT-2630
> and is therefore excluded from this ticket.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)