code: private void toRecipients(List<String> recipientData, boolean isGroup, String filter, Collection<Recipient> result) {
          result.clear();
  
          for (String data : recipientData) {
              Recipient recipient = new Recipient(data, isGroup);
  
              if (StringUtils.startsWithIgnoreCase(recipient.getName(), filter)) {
                  result.add(recipient);
              } else {
                  break;
              }
          }
      }
docs: Creates a list of recipients from a list of raw data.
  
  @param recipientData List of raw data as returned by lookup.
  @param isGroup If true, the list represents mail groups. If false, it represents users.
  @param filter The text used in the lookup. It will be used to limit the returned results.
  @param result List of recipients.