Overload Joiner.join with a function parameter
See original GitHub issueCurrently when calling Joiner.on(String).join(Iterable<E>)
the toString()
method is called to get a String from the given Object.
Sometimes you want to use getName()
or getText()
in order to get a String instead…
To achieve this the join method could be overloaded accepting a java.util.function.Fuction<T,R> parameter, with T being the generic type of the given Iterable Object, and R being a String.
This way the developer could choose how he wants to get a string from the object.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
com.google.common.base.Joiner.withKeyValueSeparator ...
Returns a MapJoiner using the given key-value separator, and the same configuration as this Joiner otherwise. Popular methods of Joiner. join. Returns a...
Read more >The best overloaded method match for 'string.Join(string ...
Join method only had overloads that took arrays as their second parameter. Support for IEnumerable<string> was only introduced in .NET 4.0.
Read more >Java 8 Streams | Collectors.joining() method with Examples
Collectors.joining(CharSequence delimiter) is an overload of joining() method which takes delimiter as a parameter, of the type CharSequence ...
Read more >How to Join Multiple Strings in Java 8 - String join() Example
join (). It has two overloaded versions, one accepts a delimiter and number of String objects as variable arguments and the other accepts...
Read more >String.Join Method (System) - Microsoft Learn
Overloads ; Join(Char, String[], Int32, Int32). Concatenates an array of strings, using the specified separator between each member, starting with the element in ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have a way of doing this, but it requires a slightly different approach:
FluentIterable.from(...).transform(...).join(joiner)
Maybe we should document this pattern on
Joiner
.Thanks, Louis. I filed https://github.com/google/guava/issues/2497 for the possible doc change.