Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More code cleanups #3975

Merged
merged 1 commit into from
Dec 28, 2023
Merged

More code cleanups #3975

merged 1 commit into from
Dec 28, 2023

Conversation

wborn
Copy link
Member

@wborn wborn commented Dec 28, 2023

While cleaning up the code I found some more code to cleanup:

  • Remove unnecessary boxing
  • Use contains(..) instead of indexOf(..) != -1
  • Use assertInstanceOf in tests
  • Make expensive trace logging conditional
  • Remove redundant constructor
  • Replace collect(Collectors.toUnmodifiableList()) with toList()
  • Replace filter(..).count() == 0L with noneMatch(..)
  • Replace filter(..).count() > 0 with anyMatch(..)

While cleaning up the code I found a some more code to cleanup:

* Remove unnecessary boxing
* Use `contains(..)` instead of `indexOf(..) != -1`
* Use `assertInstanceOf` in tests
* Make expensive trace logging conditional
* Remove redundant constructor
* Replace `collect(Collectors.toUnmodifiableList())` with `toList()`
* Replace `filter(..).count() == 0L` with `noneMatch(..)`
* Replace `filter(..).count() > 0` with `anyMatch(..)`

Signed-off-by: Wouter Born <github@maindrain.net>
@wborn wborn requested a review from a team as a code owner December 28, 2023 09:39
Copy link
Member

@J-N-K J-N-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@J-N-K J-N-K added the enhancement An enhancement or new feature of the Core label Dec 28, 2023
@J-N-K J-N-K added this to the 4.2 milestone Dec 28, 2023
@J-N-K J-N-K merged commit ba5647b into openhab:main Dec 28, 2023
3 checks passed
@wborn wborn deleted the code-cleanup branch December 28, 2023 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants