Is making an empty string constant worth it?

前端 未结 18 851
無奈伤痛
無奈伤痛 2021-01-01 10:11

I have a co-worker that swears by

//in a singleton \"Constants\" class
public static final String EMPTY_STRING = \"\";

in a constants class

18条回答
  •  醉酒成梦
    2021-01-01 10:56

    I much prefer seeing EMPTY_STRING.

    It makes it english. "".equals 'reads' differently than EMPTY_STRING.equals.

提交回复
热议问题