Easy And Faster Approach Without Using HashMap
```\nclass Solution {\n    public List findLonely(int[] nums) {\n        List l1=new ArrayList<>();\n        int n=nums.length;\n        Arrays.sort(nums);\n   
```\nclass Solution {\n    public List<Integer> findLonely(int[] nums) {\n        List<Integer> l1=new ArrayList<>();\n        int n=nums.length;\n        Arrays.sort(nums);\n        if(n==1){\n            l1.add(nums[0]);\n        }\n        else{\n        if(nums[0]!=nums[1] && nums[0]+1!=nums[1]){\n            l1.add(nums[0]);\n        }\n        if(nums[n-1]!=nums[n-2] && nums[n-1]-1!=nums[n-2]){\n            l1.add(nums[n-1]);\n        }\n        }\n        for(int i=1;i<n-1;i++){\n            if(nums[i]!=nums[i-1] && nums[i]!=nums[i+1] && nums[i]-1!=nums[i-1] && nums[i]+1!=nums[i+1]){\n                l1.add(nums[i]);\n            }\n        }\n        return l1;\n    }\n}
['Java']