The trim() method uses an unusual and dated definition of spaces to trim, whereas the strip() family of methods on String uses the modern, Unicode-based definition of whitespace.
There should be a note in the trim() method specification that refers people to the strip() family of methods. The lack of such a note may lead to bugs such asJDK-8328175 which requests methods that already exist.
The isEmpty() method could also use a note that mentions isBlank().
There should be a note in the trim() method specification that refers people to the strip() family of methods. The lack of such a note may lead to bugs such as
The isEmpty() method could also use a note that mentions isBlank().
- csr for
-
JDK-8359267 (str) Add notes to String.trim and String.isEmpty pointing to newer APIs
-
- Closed
-
- links to
-
Review(master) openjdk/jdk/25762