kucci / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

[Idea] Strings#toNonNullString(Object) #436

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be handy to have a method in Class Strings which returns a non null  
String for the passed parameter, like ""+param without creating 2 new String 
Instances.

More precise something like this->

public static String toNonNullString(Object obj){
  return obj==null?"null":obj.toString();
}

Original issue reported on code.google.com by chriss....@gmail.com on 29 Sep 2010 at 2:29

GoogleCodeExporter commented 9 years ago
Check String.valueOf(Object).

Original comment by ogregoire on 29 Sep 2010 at 2:52

GoogleCodeExporter commented 9 years ago
ogregoire is right, String.valueOf(Object) does what you want.

Original comment by boppenh...@google.com on 29 Sep 2010 at 6:39

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09