I\'m consolidating code written by two different people and notice that casting a String value into a Long has been done in two different ways.
Coder #1 has done t
Long.valueOf()
should be preferred: it returns cached values of Long for some often-used values instead of constructing a new instance as the constructor does.
Even if some Java versions don't use a cache, using valueOf()
makes it possible in future versions, whereas the constructor will always create a new instance.