Chapter 10. Sequences

A JavaFX Script sequence is a special kind of data structure that, like an array in Java, represents an ordered list of items of the same type. But unlike Java arrays, JavaFX Script sequences are not objects. Like arrays, however, they hold elements (individual items in the sequence) of the same type.


var sequence_name : datatype[];


var sequence_name : datatype[] = [value1, value2 .. value n];


var sequence_name = [value1, value2 .. value n];

The examples in Listing 10-1 show several ways to create and initialize a sequence.

Example 10.1. Different ways of defining a sequence

1. var emptySequence : Integer[]; 2. println(emptySequence); // [] 3. 4. var intSequence : Integer[] = [2,4,6,8,10]; 5. println(intSequence); // ...

Get Beginning JavaFX™ now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.