Closed GoogleCodeExporter closed 9 years ago
Perhaps we want the empty string check to be done on the result of the
toString() on each part object, and not directly on the parts themselves. In
this sense the two methods are different from useForNull and skipNulls, which
does the null check only on the part directly, and would append "null" if the
toString of a non-null object returns null.
If this is too radical, then just check for empty string on the part directly.
Original comment by yogy.nam...@gmail.com
on 16 Oct 2010 at 2:37
This seems like a case where the feature wouldn't be generally useful enough to
justify its existence, especially given that Joiner isn't just for use on lists
of Stings and that toString() methods for objects that aren't CharSequences
probably shouldn't be returning empty or blank (in my opinion).
What I'd probably do is make a Predicate "notBlank()" and/or a Function
"useForBlank(String)" and use filtering or transforming to achieve the same
result:
String skippedBlanks = Joiner.on(',').join(Iterables.filter(strings, StringPredicates.notBlank()));
String replacedBlanks = Joiner.on(',').join(Iterables.transform(strings, StringFunctions.useForBlank("none")));
Original comment by cgdec...@gmail.com
on 16 Oct 2010 at 4:19
I agree with Colin. Thanks for the suggestion, Yogy.
Original comment by kevinb@google.com
on 16 Oct 2010 at 5:28
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
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:09
Original issue reported on code.google.com by
yogy.nam...@gmail.com
on 16 Oct 2010 at 1:26