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

Refactor frame method to use isEmpty for list check and String check. #12894

Merged
merged 1 commit into from
Oct 8, 2023

Conversation

manuelsblanco
Copy link
Contributor

  • Replace frameElements.size() == 0 with frameElements.isEmpty() in the frame method of RemoteWebDriver.

This change improves code readability and adheres to best practices for checking if a list is empty.

Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Refactor in RemoteWebDriver:
Updated the frame method to use isEmpty() instead of size() == 0 for checking if a list is empty.
Refactor in Platform Initialization:
Replaced "".equals(platformString) with platformString.isEmpty() for checking if a string is empty during the platform initialization.

Motivation and Context

The primary motivation behind these changes is to improve the code quality by enhancing readability and adhering to Java's best practices. The existing code, while functional, had areas where readability and maintainability could be improved.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

- Replace `frameElements.size() == 0` with `frameElements.isEmpty()` in the `frame` method of `RemoteWebDriver`.

This change improves code readability and adheres to best practices for checking if a list is empty.
@titusfortner titusfortner merged commit bceee4e into SeleniumHQ:trunk Oct 8, 2023
@titusfortner
Copy link
Member

Thank you.

@manuelsblanco manuelsblanco deleted the IsEmptyImprove branch October 9, 2023 14:02
aguspe pushed a commit to aguspe/selenium that referenced this pull request Oct 22, 2023
…SeleniumHQ#12894)

Refactor frame method to use isEmpty for list check

- Replace `frameElements.size() == 0` with `frameElements.isEmpty()` in the `frame` method of `RemoteWebDriver`.

This change improves code readability and adheres to best practices for checking if a list is empty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants