Java tutorial
//package com.java2s; import java.util.HashSet; import java.util.Set; public class Main { /** * Converts an array of chars to a Set of Characters. * @param array the contents of the new Set * @return a Set containing the elements in the array */ public static Set<Character> arrayToSet(char... array) { Set<Character> toReturn; if (array == null) return new HashSet<Character>(); toReturn = new HashSet<Character>(array.length); for (char c : array) { toReturn.add(c); } return toReturn; } }