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.

Syntax

var sequence_name : datatype[];

or

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

or

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 O’Reilly online learning.

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