Submitted by: Octavia Anghel(octaviaanghel@gmail.com)

Monday Apr 27th 2020 by Octavia Anghel
Article Image

Language: Java, Expertise: Intermediate: See how to easily clone a list, or create a new one, in Java.

Cloning a List in Java can be done as shown below:

List newArrayList = (ArrayList) oldArrayList.clone();

Or, even better, just create a new List:

List strs;
List newStrs = new ArrayList(strs);
Mobile Site | Full Site