java easy solution
class Solution {\n    public List findLonely(int[] nums) {\n        List list1 = new ArrayList<>();\n        Arrays.sort(nums);\n        \n        if(nums.lengt
class Solution {\n    public List<Integer> findLonely(int[] nums) {\n        List<Integer> list1 = new ArrayList<>();\n        Arrays.sort(nums);\n        \n        if(nums.length==1){\n            list1.add(nums[0]);\n            return list1;\n        }\n        \n        for(int i=0; i<nums.length; i++){\n            if(i==0){\n                if(nums[i]+1!=nums[i+1] && nums[i]!=nums[i+1]){\n                    list1.add(nums[i]);\n                }\n            }\n            else if(i==nums.length-1){\n                if(nums[i]!=nums[i-1]+1 && nums[i]!=nums[i-1]){\n                    list1.add(nums[i]);\n                }\n            }\n            else{\n                if(nums[i]!=nums[i-1]+1 && nums[i]+1!=nums[i+1] && nums[i]!=nums[i-1] && nums[i]!=nums[i+1]){\n                    list1.add(nums[i]);\n                }\n            }\n        }\n        \n        return list1;\n        \n    }\n}
['Java']