8

I have a project developed in Java 11 and have to adapt in another, but using Java 8.

Some part of this Java 11 project uses the String method isBlank(), that is not recognized in Java 8. What is the best approach to adapt this method in Java 8 project?

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Murilo Góes de Almeida
  • 1,588
  • 5
  • 20
  • 42

1 Answers1

13

Best approach would be to use Apache Commons StringUtils.isBlank(String)

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.9</version>
</dependency>
  1. uses a commonly used library
  2. proven
  3. uses centralized code
  4. is very similar to the source that has to be converted
  5. Not falling for 'Not invented here' syndrome
Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Nicktar
  • 5,548
  • 1
  • 28
  • 43