⚡ Sangsakala Proxy 🏠 Home
Skip to content

Fix: redundant check and improve getLong method for proper range handling #1214

Open

Description

@JaySoni1

The getLong method currently contains a possible redundancy. Its logic checks whether left == right and returns left directly in that case. If not, it delegates to getNextLong(left, right). If getNextLong(left, right) already handles the left == right case correctly (e.g., returns left or behaves deterministically), then this method may be redundant. Leaving such logic duplicated can lead to unnecessary complexity and potential maintenance issues.

Image

Proposed change
Refactor the method to remove redundancy by:

  1. Verifying the behavior of getNextLong(left, right) when both parameters are equal.
    2)If getNextLong already returns left in this case (or handles it safely), remove the if (left == right) check.
    3)Retain or update documentation to clarify behavior.
    4)Rename or remove the method entirely if it becomes a simple wrapper with no added value.

This change simplifies the code and avoids unnecessary branching logic while ensuring consistent behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions