[JAVA] Support for CheckStyle "Do not use inline conditions"

If you do CheckStyle when you have the following source, String foo = hoge(); String bar = foo == null ? "" : foo; You will be warned that you will not use inline conditions.

If you change the CheckStyle setting, you can do it without warning, but </ font> I searched for sources that do not issue warnings.

Conclusion

Everyone loves apache.commons. String bar = StringUtils.defaultString(foo)

bonus

String hoge = BooleanUtils.toString (true," true "," false "); It seems to be useful when turning off the in-line warning.

Recommended Posts

Support for CheckStyle "Do not use inline conditions"
CheckStyle parameters
SonarQube Java 11 support
Java support period
Java8, 9, 10 support period
Support for CheckStyle "Do not use inline conditions"
[Java] Do not use "+" in append!
Item 69: Use exceptions only for exceptional conditions
Do not use instance variables in partial
Library not loaded: support for /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (LoadError)
[Rubocop] Solve Use 2 (not 1) spaces for indentation.
[Rails] How to use Gem'rails-i18n' for Japanese support
File upload with Spring Boot (do not use Multipart File)