Youssef Shoaib [MOD]
06/14/2023, 2:44 AMjoinToString
not being inline has been a (rather mild) inconvenience for me. Is there a reason why it isn't? I know that the stdlib is using a default value of null
for the transform lambda, but couldn't it just use it.toString()
?Klitos Kyriacou
06/14/2023, 3:34 PMtoString()
for non-String elements. A StringBuilder
can have numbers appended directly to it without building a String first, but joinToString
nevertheless creates intermediate Strings.Derek Peirce
06/14/2023, 8:18 PMjoinToString
is called rarely enough that having a toString
call within the lambda isn't much boilerplate while confirming that you're using the right object and intend to turn it into a string. Compare that to StringBuilder
, where you may regularly add multiple primitive values in a row and the code becomes mostly toString
calls.