2010-03-22 3 views

답변

1

ac.addItemAt(ac.removeItemAt(n), n-1); 

ArrayList의에 remove... 기능 항목을 반환

이 제거되는 한 줄 :)를 호출 컬렉션.

+1

n-1이 범위를 벗어나지 않았는지 확인하지 않으면이 폭탄이 터집니다. 이 기능은 읽기 쉽지 않고 유익하지 못하지만 내 대답은 뻔뻔 스럽습니다. 당신의 웃음을 지키십시오. – Robusto

6
var ac:ArrayCollection = new ArrayCollection(yourArraySource); 
ac.removeItemAt(n); // where n > 0 and n < ac.length 
ac.addItemAt(item, n-1); // where n>0 ... you should test for that