Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

cloning of list in java

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
  
class Example {
    public static void main(String[] args)
    {
        // Create a list
        List<String> original
            = Arrays.asList(
                "GeeksForGeeks",
                "A Computer Science",
                "Portal");
  
        // Clone the list
        List<String> cloned_list
            = new ArrayList<String>(original);
  
        System.out.println(cloned_list);
    }
}
 
PREVIOUS NEXT
Tagged: #cloning #list #java
ADD COMMENT
Topic
Name
2+4 =