O'Reilly logo

Beginning JavaFX™ by Praveen Mohan, Lawrence PremKumar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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); // ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required