natorder
natorder copied to clipboard
Char and int comparison
Line 51 is never true for all the examples I put into it.
https://github.com/paour/natorder/blob/ab9e2dfd165736a90f3d8784e76c906e6603db52/NaturalOrderComparator.java#L51
Is it supposed to compare with 0 (space) or with 48 (0)?
if (ca == '0' && cb == '0') {
The condition cannot evaluate to true because of
https://github.com/paour/natorder/blob/ab9e2dfd165736a90f3d8784e76c906e6603db52/NaturalOrderComparator.java#L42
If both ca and cb are 0 (space, non-digit) bias will be returned.
So L51 is either redundant or should be changed to check for 48 or '0' respectively
The line is indeed redundant: if both ca
and cb
are 0
, then neither is a digit.
Thank you for the clarification
Fixed by #9
This is the wrong issue for PR #9
I have no PR for the redundancy issue because I was unsure.
PR #9 is for Issue #1