why can not modify the Integer instance in HashSet in java? : example:

        ArrayList<Integer> a = new ArrayList<Integer>();
        a.add(1);
        a.add(2);
        System.out.println(a.get(0));
        a.get(0) = 10;

it comes with an error --- variable expected. But if I do not use classes declared by myself, I can easily modify the elements. why?