ArrayList clone() method in java

Let’s learn ArrayList clone() method in java. ArrayList clone() method in java clone() method of ArrayList class returns a shallow copy of this ArrayList instance. Syntax: ArrayList.clone() Now let’s see example on ArrayList clone() method. 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”);…

Read More ArrayList clone() method in java