Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

copy arraylist java

List<Something> original=new ArrayList<>();
//insert elements
List<Something> copy=new ArrayList<>(original);//create copy here
System.out.println(copy.equals(original));//true because the copy has the same elements
System.out.println(copy==original);//false because it is another List
 
PREVIOUS NEXT
Tagged: #copy #arraylist #java
ADD COMMENT
Topic
Name
4+7 =