static void parseCsv(List<String> groups, String csv) {
    if (csv == null || csv.length() == 0) {
      return;
    }
    StringTokenizer st = new StringTokenizer(csv, ",");
    while (st.hasMoreTokens()) {
      String groupName = st.nextToken().trim();
      if (!groups.contains(groupName)) { // only add each group once
        groups.add(groupName);
      }
    }
  }
Parses comma-separated-roles/groups into array of groups (strings).
geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/api/MemberDataBuilder.java