Duplicate elements are discarded
import java.util.Arrays; import java.util.HashSet; import java.util.Set; public class Main { public static void main(String[] argv) throws Exception { int[] array = new int[10]; Set set = new HashSet(Arrays.asList(array)); } }