code: private List<String> transformSimpleSequenceAsStringList(SimpleSequence sequence, String paramName)
              throws TemplateModelException {
          List<String> list = new ArrayList<>();
          int size = sequence.size();
          for (int i = 0; i < size; i++) {
              TemplateModel model = sequence.get(i);
              if (!(model instanceof SimpleScalar)) {
                  throw new IllegalArgumentException(paramName + "'s item must be string");
              }
              list.add(((SimpleScalar)model).getAsString());
          }
          return list;
      }
docs: Transform simple sequence as string list.
  
  @param sequence the sequence
  @param paramName the param name
  @return the list
  @throws TemplateModelException the template model exception