I have some data structures, and I would like to use one as a temporary, and another as not temporary.
ArrayList
Suppose you have two arraylist of String type . Like
ArrayList firstArrayList ;//This array list is not having any data.
ArrayList secondArrayList = new ArrayList<>();//Having some data.
Now we have to copy the data of second array to first arraylist like this,
firstArrayList = new ArrayList<>(secondArrayList );
Done!!