PDA

View Full Version : How to Initialize an arraylist


jmandawg
10-05-2010, 05:22 PM
Hi,

How can i initialize an arraylist with data? IIRC there is a one line way to do it something like:

public static var categories:ArrayList = new ArrayList("john", "smith");

Thanks.

ASWC
10-05-2010, 05:29 PM
public var categories:ArrayList;
//constructor if any
categories = new ArrayList();
//categories.addItem(); add an Object
//categories.addItemAt(); add an Object
//categories.addAllAt(); add an IList
//categories.addAll(); add an IList

jmandawg
10-05-2010, 05:58 PM
Ok, thanks. I thought there was a one-liner for doing it.