[code]class Solution {public boolean containsDuplicate(int[] nums) {if(nums == null || nums.length == 0){return false;}Set<Integer> seen = new HashSet<>();for(int num: nums){// If the set already has this element, add() method will return falseif(!seen.add(num)){return true;}}return false;}}