Here you can find the source of memcpy(ArrayList
public static <T> ArrayList<T> memcpy(ArrayList<T> src)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; public class Main { public static <T> T[] memcpy(T[] src) { if (src == null) return null; return Arrays.copyOf(src, src.length); }//from w ww .j a v a 2s . c o m public static <T> ArrayList<T> memcpy(ArrayList<T> src) { if (src == null) return null; ArrayList<T> dst = new ArrayList<T>(); for (int c = 0; c < src.size(); c++) { dst.add(src.get(c)); } return dst; } }