// Do it this way to only walk through the recipient list once.
for (int i = 0; i < recipients.length; i++) {
// Lookup the target MessageRecipients object from the Map, using
// the RecipientType as the key.
MessageRecipients target = (MessageRecipients)
mapping.get(recipients[i].getRecipientType());
// Translate the current Recipient into a MessageRecipient and add
// it to the target MessageRecipients.
try {
MessageRecipient mpsRecipient = createMessageRecipient(recipients[i]);
target.addRecipient(mpsRecipient);
} catch (RecipientException e) {
LOGGER.warn("add-recipient-failure", recipients[i]);
}
}