This might seem to be a no-brainer at first glance. It probably is, but a few things have me feeling I might be missing something. First the Java documentation for Character.isWhitespace seems to exclude it. The definition for what is and what is not allowed as whitespace seems very definitive ('if and only if') and the first line says not a non-breaking space.
I have always regarded an ordinary 'space' - that thing you get when you press a spacebar - as a non-breaking space.
So where does it fit in the list? The list is regarded as definitive in the highest rated answer to this question - am I simply reading it wrong? Also, the first commenter to the top answer in this question seems to have his doubts (in a different context). Yet when I construct a simple bit of code to test, it indicates that a normal space is an instance of whitespace, as one would expect.
import static java.lang.Character.isWhitespace;
public class WhitespaceCheck {
public static void main(String[] args) {
Character test = ' ';
if (Character.isWhitespace(test)) {
System.out.println("Is whitespace!" );
} else {
System.out.println("Is not whitespace!" );
}
}
}
So, am I reading the first item on the list wrongly, is it somewhere else on the list, or is the list itself simply wrong?