3 replaced http://stackoverflow.com/ with https://stackoverflow.com/
source | link

In a typical spring mvc validator class, while inserting an errorCode value in the Errors object, what difference does it make between using a String (props.somefield.req) like so

errors.rejectValue("elementId", "props.somefield.req");

verses a declared static final String ?

private static final String SOMFIELD_REQ = "props.somefield.req"; ...
errors.rejectValue("elementId", SOMFIELD_REQ);

Does it improve the performance even in a slightest way? I have read a few questions on stack overflow (String and finalString and final, Does it make sense to define a final String in Java?Does it make sense to define a final String in Java?) but no one got around to answering this questionsthis questions update question.

In a typical spring mvc validator class, while inserting an errorCode value in the Errors object, what difference does it make between using a String (props.somefield.req) like so

errors.rejectValue("elementId", "props.somefield.req");

verses a declared static final String ?

private static final String SOMFIELD_REQ = "props.somefield.req"; ...
errors.rejectValue("elementId", SOMFIELD_REQ);

Does it improve the performance even in a slightest way? I have read a few questions on stack overflow (String and final, Does it make sense to define a final String in Java?) but no one got around to answering this questions update question.

In a typical spring mvc validator class, while inserting an errorCode value in the Errors object, what difference does it make between using a String (props.somefield.req) like so

errors.rejectValue("elementId", "props.somefield.req");

verses a declared static final String ?

private static final String SOMFIELD_REQ = "props.somefield.req"; ...
errors.rejectValue("elementId", SOMFIELD_REQ);

Does it improve the performance even in a slightest way? I have read a few questions on stack overflow (String and final, Does it make sense to define a final String in Java?) but no one got around to answering this questions update question.

    Tweeted twitter.com/#!/StackProgrammer/status/491879548003561472
2 added 75 characters in body; edited tags
source | link

In a typical spring mvc validator class, while inserting an errorCode value in the Errors object, what difference does it make between using a String (props.somefield.req) like so

errors.rejectValue("elementId", "props.somefield.req");

verses a declared static final String ?

private static final String SOMFIELD_REQ = "props.somefield.req"; ...
errors.rejectValue("elementId", SOMFIELD_REQ);

Does it improve the performance even in a slightest way  ? I have read a few questions on stackoverflowstack overflow (http://stackoverflow.com/questions/874978/string-and-finalString and final  , http://stackoverflow.com/questions/10233309/does-it-make-sense-to-define-a-final-string-in-javaDoes it make sense to define a final String in Java?) but no one got around to answering this questions update question.

In a typical spring mvc validator class, while inserting an errorCode value in the Errors object, what difference does it make between using a String (props.somefield.req) like so

errors.rejectValue("elementId", "props.somefield.req");

verses a declared static final String ?

private static final String SOMFIELD_REQ = "props.somefield.req"; ...
errors.rejectValue("elementId", SOMFIELD_REQ);

Does it improve the performance even in a slightest way  ? I have read a few questions on stackoverflow (http://stackoverflow.com/questions/874978/string-and-final  , http://stackoverflow.com/questions/10233309/does-it-make-sense-to-define-a-final-string-in-java) but no one got around to answering this questions update question.

In a typical spring mvc validator class, while inserting an errorCode value in the Errors object, what difference does it make between using a String (props.somefield.req) like so

errors.rejectValue("elementId", "props.somefield.req");

verses a declared static final String ?

private static final String SOMFIELD_REQ = "props.somefield.req"; ...
errors.rejectValue("elementId", SOMFIELD_REQ);

Does it improve the performance even in a slightest way? I have read a few questions on stack overflow (String and final, Does it make sense to define a final String in Java?) but no one got around to answering this questions update question.

1
source | link

Why to declare a String (as final) and then use it?

In a typical spring mvc validator class, while inserting an errorCode value in the Errors object, what difference does it make between using a String (props.somefield.req) like so

errors.rejectValue("elementId", "props.somefield.req");

verses a declared static final String ?

private static final String SOMFIELD_REQ = "props.somefield.req"; ...
errors.rejectValue("elementId", SOMFIELD_REQ);

Does it improve the performance even in a slightest way ? I have read a few questions on stackoverflow (http://stackoverflow.com/questions/874978/string-and-final , http://stackoverflow.com/questions/10233309/does-it-make-sense-to-define-a-final-string-in-java) but no one got around to answering this questions update question.