@@ -0,0 +1,709 @@
+package leetcode.contains_duplicate_ii;%0A%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0Apublic class Solution %7B%0A    public boolean containsNearbyDuplicate(int%5B%5D nums, int k) %7B%0A        Set%3CInteger%3E window = new HashSet%3CInteger%3E(k);%0A        for(int i = 0; i %3C k && i %3C nums.length; i++)%7B%0A            if(window.contains(nums%5Bi%5D))%7B%0A                return true;%0A            %7Delse%7B%0A                window.add(nums%5Bi%5D);%0A            %7D%0A        %7D%0A        for(int i = k; i %3C nums.length; i++)%7B%0A            if(window.contains(nums%5Bi%5D))%7B%0A                return true;%0A            %7Delse%7B%0A                window.add(nums%5Bi%5D);%0A                window.remove(nums%5Bi - k%5D);%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A%7D

Add java solution for 219. Contains Duplicate II