대학 생활/JAVA
[JAVA] 리스트와 배열 간 복사 방법
opid
2015. 4. 8. 00:56
import java.util.Arrays; import java.util.List; public class Test { public void copyByArray(int[] source) { int[] target = new int[source.length]; // arraycopy(원본 배열, 복사 시작 위치, 대상 배열, 대상 배열의 시작 위치, 복사 길이); System.arraycopy(source, 0, target, 0, source.length); } public List copyByList(Integer[] args) { Listlist = (List ) Arrays.asList(args); return list; } }