Java most elegant way possible
\nclass Node {\n    public int val;\n    public Node next;\n\n    public Node(int val) {\n        this.val = val;\n    }\n}\n\nclass MyHashSet {\n\n    private 
```\nclass Node {\n    public int val;\n    public Node next;\n\n    public Node(int val) {\n        this.val = val;\n    }\n}\n\nclass MyHashSet {\n\n    private static final int size = 10000;\n    \n    Node[] hashSet = new Node[size];\n    \n    public MyHashSet() {\n\n    }\n\n    public void add(int key) {\n        Node pointer = hashSet[key % size];\n        if (pointer == null) {\n            hashSet[key % size] = new Node(key);\n        } else {\n            Node current = pointer;\n            Node previous = current;\n            while (current != null) {\n                if (current.val == key) return;\n                previous = current;\n                current = current.next;\n            }\n            previous.next = new Node(key);\n        }\n\n    }\n\n    public void remove(int key) {\n\n        Node current = hashSet[key % size];\n\n        while (current != null) {\n            if (current.val == key) {\n                current.val = -1; // Simply replace with -1\n                return;\n            }\n            current = current.next;\n        }\n    }\n\n    public boolean contains(int key) {\n        Node current = hashSet[key % size];\n        while (current != null) {\n            if (current.val == key) return true;\n            current = current.next;\n        }\n        return false;\n    }\n}\n```
['Java']