google / guava

Google core libraries for Java
Apache License 2.0
50.01k stars 10.86k forks source link

Decorate Joiner Outputs #463

Closed gissuebot closed 9 years ago

gissuebot commented 9 years ago

Original issue created by emilchacko on 2010-10-30 at 11:06 AM


I think a new additional function to decorate the Joiner output will be useful. Example :     int[] arr= {1,2,3};     Joiner.on(", ").decorate('(',')').join(Ints.asList(arr))); Output: (1,2,3)

gissuebot commented 9 years ago

Original comment posted by amertum on 2010-10-30 at 12:37 PM


"(" + Joiner.on(", ").join(Ints.asList(arr))) + ")"; will do the same and is shorter ;-)

but decoration may be seen as outputting "(1),(2),(3)" instead.

Which is more in adequacy with the logic of the join for me.

gissuebot commented 9 years ago

Original comment posted by finnw1 on 2010-11-01 at 03:05 AM


How about:

"(" + Joiner.on("},{").join(Ints.asList(arr))) + ")";

gissuebot commented 9 years ago

Original comment posted by kevinb@google.com on 2010-11-02 at 06:28 PM


I'd like to keep Joiner focused on being a Joiner, not a JoinerAndSurrounder. :-)


Status: WontFix

gissuebot commented 9 years ago

Original comment posted by lowasser@google.com on 2014-05-16 at 07:01 PM


Issue #1758 has been merged into this issue.