List

A List is a collection of elements of any data type. List elements can be of any valid Intent data type, including other lists. Each member of a list can be of a different data type. Empty lists are allowed.

The following example shows a list that contains five elements of type Integer .

{17, 5, 64, 2, 88} 

A list literal is enclosed in curly braces; a list reference is not (example: myList). Commas separate list elements in a list literal. List literals within a list must be enclosed in curly braces. A list reference need not be enclosed.

The following example shows a list whose elements are of various data types. This list contains only literals.

{12, 32.4, "TEST", {"Item No.", 10272004}, {"Description", "Sprocket"}, True} 

The next example includes some list objects: myList and partList. These elements do not need to be enclosed within braces, because they are not list literals.

{12, 32.5, "TEST", {partList, 2}, myList, "Sprocket", True} 

The addition operator is used to concatenate two lists into a single list (see Addition Operator).