티스토리 뷰

[자바] 배열을 ArrayList나 Vector로 바꾸는 방법

It's quite simple. Use the static function of Arrays class.

int[] elements = {1,2,3,4};
Vector myVector = new Vector(Arrays.asList(elements)); 

Reference : http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html 
static
<T> List<T>
asList(T... a) 
          Returns a fixed-size list backed by the specified array.
 
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함