Ok, I'm sure that this must exist on here somewhere, but I can't seem to find it.
Is there, and if there is what is, a minimum (non-null) String
sequence according to String#CompareTo
?
I'm guessing ""
but I'm not entirely sure.
Ok, I'm sure that this must exist on here somewhere, but I can't seem to find it.
Is there, and if there is what is, a minimum (non-null) String
sequence according to String#CompareTo
?
I'm guessing ""
but I'm not entirely sure.
Yes the minimum length string will be an empty string "" with a length of 0. I don't think there will be such a string with length less than 0.
There is no minimum length, since you can validly compare two empty strings with
"".compareTo("")
Edit:
Try this,
Here compareTo returns nothing in System.out.println(), so the minimum string will be "" or String.Empty
AFAIK, There is no minimum lenght and you can not find a string with the length <0, so the minimum length for the string 0 (string.Empty or "").
Check this source code of CompareTo ,
Given the implementation of
String#compareTo
(see source) you can verify that a string of size 0 (thus the empty string) will always be inferior or equal to any other non null string. (equal in case of comparing to the empty string).Yes it is a empty String with not values in it.
Take a look at this sample code :