code: public static Set<String> simpleSequenceToSet(SimpleSequence simpleSequence)
      {
          if (simpleSequence == null)
              return Collections.emptySet();
  
          Set<String> result = new HashSet<>();
          for (int i = 0; i < simpleSequence.size(); i++)
          {
              try
              {
                  Object sequenceEntry = simpleSequence.get(i);
                  if (sequenceEntry instanceof SimpleScalar)
                  {
                      result.add(((SimpleScalar) sequenceEntry).getAsString());
                  }
                  else
                  {
                      result.add(simpleSequence.get(i).toString());
                  }
              }
              catch (Exception e)
              {
                  throw new RuntimeException(e);
              }
          }
          return result;
      }
docs: Converts a FreeMarker {@link SimpleSequence} to a {@link Set}.