First lambda, formatter for StringJoiner?

Brenden Towey brendentowey at gmail.com
Fri Jun 21 12:39:08 PDT 2013


Hi all,

I played around with the Java 8 early access build for the first time 
last week.  Overall it was fun and I learned a bit.  One thing struck me 
looking at the Collectors.toStringJoiner() method:

StringJoiner is pretty neat but it could use a formatter string, like 
java.util.Formatter.  It's a common pattern to need to format objects as 
one collects them into a string.  For example, a stream of bytes will 
often need to be formatted as two character hexidecimal strings, rather 
than the default decimal representation.

Adding a formatter string both to StringJoiner's ctor as well as to the 
static convenience method in Collectors would be a big boon to Java 
programmers everywhere.

OK, that's my 2 cents!  Good luck folks.

Brenden




More information about the lambda-dev mailing list