Is StringUtils.EMPTY recommended?

后端 未结 11 1951
情深已故
情深已故 2020-12-08 01:46

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

11条回答
  •  生来不讨喜
    2020-12-08 02:15

    I don't really like to use it, as return ""; is shorter than return StringUtils.EMPTY.

    However, one false advantage of using it is that if you type return " "; instead of return "";, you may encounter different behavior (regarding if you test correctly an empty String or not).

提交回复
热议问题