Is StringUtils.EMPTY recommended?

后端 未结 11 1956
情深已故
情深已故 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

    Of course not. Do you really think "" is not clear enough ?

    Constants have essentially 3 use cases:

    1. Document the meaning of a value (with constant name + javadoc)
    2. Synchronize clients on a common value.
    3. Provide a shortcut to a special value to avoid some init costs

    None apply here.

提交回复
热议问题