Do you use StringUtils.EMPTY
instead of \"\"
?
I mean either as a return value or if you set a the value of a String variable. I don\'t mean
I find StringUtils.EMPTY
useful in some cases for legibility. Particularly with:
Ternary operator eg.
item.getId() != null ? item.getId() : StringUtils.EMPTY;
Also by using a constant, a reference to StringUtils.EMPTY
is created. Otherwise if you try to instantiate the String literal ""
each time the JVM will have to check if it exists in the String pool already (which it likely will, so no extra instance creation overhead). Surely using StringUtils.EMPTY
avoids the need to check the String pool?