I am developing an Android project. First of all, I am not a Java developer. Now I want to know something in about Java programming, especially about ArrayList.

Here is my code:

```
        ArrayList<Bitmap> previewBitmaps = new ArrayList<Bitmap>();
        //initialize values - total 3 elements
        previewBitmaps.remove(2);
        ArrayList<Bitmap> temp = new ArrayList<Bitmap>();
        temp = previewBitmaps;
        previewBitmaps.removeAll(previewBitmaps);
        //here temp size become zero because previewBitmaps cleared

```

As you can see in the above code, I remove an item from previewBitmaps, then I assigned the rest 2 items to temp. So size of temp will be 2. Then I clear previewBitmaps. So previewBitmaps size become 0. But the problem is temp size also become 0. Why?

Actually temp size should be 2. Right? What I am not clear is whether it is assigned as reference variable in C? Why? How can I clear that reference?