javaarraysarraylistduplication

How to Duplicate an array list in Java?


I have an array list that stores objects called Movie. The objects contain variables such as name , date released ,genre etc.. Is there a way to duplicate the array so I can sort it one by one keep the original data unchanged. I will be displaying the data in text areas.


Solution

  • Use

    List<Movie> newList = new ArrayList<>(existingList);