Would this be the correct method to check whether an integer array contains duplicates? I wanted to pass in an int[] nums instead of Integer[], but couldn't get that to work.
public static boolean isUnique(Integer[] nums){
return new HashSet<Integer>(Arrays.asList(nums)).size() == nums.length;
}