Skip to content

Suggest using .equals instead of Objects.equals when applicable #663

@Luro02

Description

@Luro02

What it does

When the left-hand side or right-hand side is guaranteed to not be null, it is more readable to use rhs.equals(lhs) or lhs.equals(rhs) than Objects.equals(lhs, rhs).

Unresolved: Is this more readable or just pedantic?

Lint Name

No response

Category

No response

Example

Objects.equals(variable, MY_CONSTANT)

Could be written as:

MY_CONSTANT.equals(variable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions