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.
Everyone loves apache.commons.
String bar = StringUtils.defaultString(foo)
String hoge = BooleanUtils.toString (true," true "," false ");
It seems to be useful when turning off the in-line warning.
Recommended Posts