Java tutorial
//package com.java2s; import java.util.HashSet; import java.util.Set; public class Main { private static Set<Character> strToSet(final String str) { Set<Character> set; if (str == null) { return new HashSet<Character>(); } set = new HashSet<Character>(str.length()); for (int i = 0; i < str.length(); i++) { set.add(str.charAt(i)); } return set; } }