-2

Is it more expensive to use String.valueOf("/any non-String value/") or to use non-String-value.toString()?

I am asking in the context of wanting to insert non-String values in a String.format statement:

Html.fromHtml(String.format("<b> %s </b>", value.toString or String.valueOf(value))) ?

As I want my code to be as efficient as possible.

Thanks!

Jens
  • 67,715
  • 15
  • 98
  • 113

1 Answers1

0

value.toString() but in full honesty the are doing the same thing. Can return a null pointer exception though

wurzja
  • 99
  • 1
  • 12