Sometimes, we face the problem of generating text based on collections' elements. This is where the Iterable.joinToString() extension function can help. For example, we can consider working on an email-message-forwarding feature. When a user clicks the forward button, the original message's body text is concatenated, with the prefix looking something like this:
<br/>
<p>---------- Forwarded message ----------</p>
<p>
From: johny.b@gmail.com <br/>
Date: 14/04/2000 <br/>
Subject: Any plans for the evening?<br/>
To: natasha@gmail.com, barbra@gmail.com<br/>
</p>
In this recipe, we are going to implement a function that is going to generate the recipients' string, for example:
To: natasha@gmail.com, barbra@gmail.com</br>
For a given list of Address type objects, it is defined...