joinList static method

String joinList(
  1. List<String> items,
  2. String conjunction
)

Join items list

Implementation

static String joinList(List<String> items, String conjunction)
{
  StringBuffer sb = new StringBuffer();
  for (int i = 0; i < items.length; i++)
  {
    String item = items[i];
    if (i > 0) {
      if (i < items.length - 1) {
        sb.write(", ");
      }
      else {
        sb.write(" ${conjunction} ");
      }
    }
    sb.write(item);
  }
  return sb.toString();
}