what does arraylist.clone() do code example
Example: ArrayList clone() method in java
import java.util.ArrayList;
public class ArrayListCloneMethodExample
{
public static void main(String[] args)
{
ArrayList<String> al = new ArrayList<String>();
al.add("violet");
al.add("indigo");
al.add("blue");
al.add("green");
al.add("yellow");
System.out.println("ArrayList before using clone() method: " + al);
ArrayList<String> arrClone = new ArrayList<String>();
arrClone = (ArrayList)al.clone();
System.out.println("ArrayList after using clone() method: " + arrClone);
}
}