public void insert(T newVal) {
        if (newVal == null) {
            throw new IllegalArgumentException();
        }

        if (root == null) {
            root = new Node<>(newVal);
            return;
        }

        Node<T> tmp = root;
        int compRes = -1;

        while (tmp != null) {
            compRes = comparator.compare(newVal, tmp.value);
            if (compRes > 0) {
                if (tmp.right == null) {
                    tmp.right = new Node<>(newVal);
                    break;
                }
                tmp = tmp.right;
            } else if (compRes < 0) {
                if (tmp.left == null) {
                    tmp.left = new Node<>(newVal);
                    break;
                }
                tmp = tmp.left;
            } else {
                tmp.count++;
                break;
            }
        }
    }