You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix: redundant check and improve getLong method for proper range handling #1214
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.
Proposed change
Refactor the method to remove redundancy by:
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