Dave's Brain

Browse - Programming Tips - How can I make a copy of an ArrayList ?

Date: 2016jun8
Language: Java
Keywords: duplicate, clone

Q.  How can I make a copy of an ArrayList ?

A.  The constructor can do it:

ArrayList<String> theClone = new ArrayList<String>(theOriginal);

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.