Like jav开发者_JAVA百科a, I want to create a method that accepts an array list of particular object type.
In java:
public void addStudents(List<Student> students) {
...
}
In actionscript
public function addStudents(students:ArrayCollection):void {
.....
}
Here I want to have public function addStudents(students:ArrayCollection).
Thanks
If you have a Student object and publish for FP10 you can use the Vector object.
public function addStudents(students:Vector.<Student>):void {}
For further information: http://help.adobe.com/en_US/AS3LCR/Flash_10.0/Vector.html
As far as i know, AS has no template-like generics. But you can extend ArrayCollection into something like StudentArrayCollection with more rigid type check inside.
精彩评论