JAVA || 2 LINE CODE || HASHMAP
\n# Code\n\nclass Solution {\n    public List<Integer> findLonely(int[] arr) {\n        HashMap<Integer, Integer> map = new HashMap<>();\n        ArrayList<Inte
\n# Code\n```\nclass Solution {\n    public List<Integer> findLonely(int[] arr) {\n        HashMap<Integer, Integer> map = new HashMap<>();\n        ArrayList<Integer> list = new ArrayList<>();\n        \n        for (int i : arr) map.put(i, map.getOrDefault(i, 0) + 1);\n        for (int i : arr) if (map.get(i) == 1 && !map.containsKey(i - 1) && !map.containsKey(i + 1)) list.add(i);\n        return list;\n    }\n}\n```
['Java']