So I have seen this question, which gives several ways to convert integers to Strings, but I am wondering if there is any difference between them.
If I want to just convert an integer i to a string, then is there a difference between these three ways (and are some faster than others)?
i+""
Integer.toString(i)
String.valueOf(i)
I would be inclined to use the second or third since the first one just seems weird to me. On the other hand, if I wanted to convert an integer i to a string and then concatenate it to another string, s, I could do:
i+s
Integer.toString(i)+s
String.valueOf(i)+s
Here I would be inclined to use the first one since I am concatenating anyway. But my question is: are there any standard practices that should be used here, and what exactly are the differences (if any) among these three methods?