concept sequence element in category java

appears as: sequence element
JavaFX in Action

This is an excerpt from Manning's book JavaFX in Action.

Listing 2.19. Referencing a sequence element
import java.lang.System; def faceCards = [ "Jack" , "Queen" , "King" ]; var king = faceCards[2]; def ints = [10,11,12,13,14,15,16,17,18,19,20]; var oneInt = ints[3]; var outside = ints[-1]; System.out.printf("faceCards[2] = {king}\n" "ints[3] = {oneInt}\n" "ints[-1] = {outside}\n"); faceCards[2] = King ints[3] = 13 ints[-1] = 0
Listing 2.31. Binding against a sequence element

When we bind against a sequence element, we do so by way of its index—when the sequence is extended or truncated, the bind does not track the change by adjusting its index to match. In listing 2.31, even though the first element of range is deleted, causing the other elements to move down the sequence, the bind still points to the third index. Also, as we’d expect, accessing the third index after all elements have been deleted returns a default value.