Class: Toybox.Lang.Array
- Inherits:
-
Toybox.Lang.Object
Overview
Array objects are fixed size, numerically indexed, single dimensional, and take any Objects (including Arrays) as members. Array keys must be Numbers, but Array values may be any type of Object.
Instance Method Summary collapse
-
add(object as Lang.Object or Null) as Lang.Array<Lang.Object or Null>
Add an Object to the end of an Array.
-
addAll(array as Lang.Array<Lang.Object or Null>) as Lang.Array<Lang.Object or Null>
Add an Array of Objects to the end of an Array.
-
indexOf(object as Lang.Object or Null) as Lang.Number
Get the index of an Object within the Array.
-
remove(object as Lang.Object or Null) as Lang.Boolean
Remove an Object from an Array.
-
removeAll(object as Lang.Object or Null) as Lang.Boolean
Remove Objects from an Array.
-
reverse() as Lang.Array<Lang.Object or Null>
Return a new Array that contains the elements of a source Array in reverse order.
-
size() as Lang.Number
Get the size of an Array.
-
slice(startIndex as Lang.Number or Null, endIndex as Lang.Number or Null) as Lang.Array<Lang.Object or Null>
Get a new Array containing a portion of an existing Array.
-
sort(comparator as Lang.Comparator or Null) as Void
Sort an Array.
-
toString() as Lang.String
Convert an Array to a String.
Instance Method Details
add(object as Lang.Object or Null) as Lang.Array<Lang.Object or Null>
Add an Object to the end of an Array.
When adding an Object, the Array size is increased by one and the new Object is inserted at the new index.
addAll(array as Lang.Array<Lang.Object or Null>) as Lang.Array<Lang.Object or Null>
Add an Array of Objects to the end of an Array.
When adding an Array of Objects, the Array is expanded by the size of the provided Array, and all of the new elements are inserted starting at the new index.
indexOf(object as Lang.Object or Null) as Lang.Number
Get the index of an Object within the Array.
remove(object as Lang.Object or Null) as Lang.Boolean
Remove an Object from an Array.
If the passed Object is found, the Array size is decreased by one and elements beyond it are shifted to the next lower index. If the Array has multiple matches, the matching Object at the lowest index will be removed but the other matching Objects will not be removed.
removeAll(object as Lang.Object or Null) as Lang.Boolean
Remove Objects from an Array.
For each instance of the Object that is found, the Array size is decreased by one and elements beyond it are shifted to the next lower index.
reverse() as Lang.Array<Lang.Object or Null>
Return a new Array that contains the elements of a source Array in reverse order.
size() as Lang.Number
Get the size of an Array.
slice(startIndex as Lang.Number or Null, endIndex as Lang.Number or Null) as Lang.Array<Lang.Object or Null>
Get a new Array containing a portion of an existing Array.
sort(comparator as Lang.Comparator or Null) as Void
Sort an Array
toString() as Lang.String
Convert an Array to a String.
This does not convert the elements of the Array into Strings, but transforms the entire Array into a String.