I would like to convert the string containing abc
to a list of characters and a hashset of characters. How can I do that in Java ?
List
The lack of a good way to convert between a primitive array and a collection of its corresponding wrapper type is solved by some third party libraries. Guava, a very common one, has a convenience method to do the conversion:
List characterList = Chars.asList("abc".toCharArray());
Set characterSet = new HashSet(characterList);