Java tutorial
//package com.java2s; //License from project: LGPL import java.util.HashSet; import java.util.Set; import java.util.TreeSet; public class Main { public static Set<String> parseSeparetedStringSet(String inputString, String delim) { Set<String> ret = new TreeSet<String>(); String[] data = inputString.split(delim); for (String d : data) { ret.add(d.trim()); } return ret; } public static Set<String> split(String string, String separator) { Set<String> set = new HashSet<String>(); if (string == null) return set; String[] split = string.split(separator); for (String v : split) set.add(v.trim()); return set; } }