Prev | Current Page 120 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


However, the List does provide a couple of methods that will enable you to read the values stored at
the very beginning or end of the List without removing the items. These are first and last .
As you would expect, the method first allows you to query the first item in a List , while last allows
you to query the last item:
var firstItem : Int = myList.first();
var lastItem : Int = myList.last();
Hash Tables
A Hash , or Hash Table , is a type of Array that allows access to its values using keys. Storing data in an
Array of this type removes the ambiguity of the contained data and helps to give some form of
individuality to each item. The type of key used by the Hash depends on the type of Hash you choose to
use. haXe offers two versions of Hash that provide identical functionality, except the Hash type uses keys
of a String type, while the IntHash uses keys of an Int type.
Like List s, Hash ??™ s do not support accessing values using indexes. This is because Hash ??™ s do not store
their values in such an obviously linear fashion.


Pages:
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132