String [] a = { "apple", "snapple", "crackle" }; HashSet<String> choices = new HashSet<String>(Arrays.asList(a));
Programming Tips - Java: best way to convert a Java array into an HashSet
Date: 2016jan22
Language: Java
Q. Java: best way to convert a Java array into an HashSet<>
A. Use Arrays.asList() in the HashSet constructor, like this: