![]() | Force-FrameworkMark Brennand |
| Description | Class providing the Array API. See README for full details of the Array API. Copyright (c) 2025 Mark Brennand, released under MIT License. |
|---|---|
| Author | Mark Brennand |
| Description | Creates the iterator for an array of objects. The method to iterate the array with may then be called. If data is to be shared between callbacks, call the shared() method before the iterator method. |
|---|---|
| Parameter | objects: The array of objects to be iterated. |
| Returns | The methods that may be called on the array. |
| Description | Creates the iterator from an Object. If the Object is Iterable a List is built from it, otherwise a List is used with a single element, the object. The method to iterate the array with may then be called. If data is to be shared between callbacks, call the shared() method before the iterator method. |
|---|---|
| Parameter | source: The source object. |
| Returns | The methods that may be called on the array. |
| Description | Exception thrown when an operation in the Array API fails. |
|---|
| Description | Class representing a callback to process each iterated array element. The function() method must be overridden to code the logic to be performed on the array element. Data shared on initiation of the iterator is accessed using the shared() method. |
|---|
| Description | This class must be extended to code the logic to be performed on each array element. The method will be called for each element. The currentValue will be null, except when the callback is being called from the reduce() method. In this case, its value will be the accumulated result of all the previous callbacks. See the iterator methods for details of the return values expected from the callback. |
|---|---|
| Parameter | element: The current array element. |
| Parameter | currentValue: The value accumulated over the array iteration. |
| Parameter | index: The positional index of the array element. |
| Returns | A value representing the result of the processing. |
| Description | Returns the shared data for the callback. |
|---|---|
| Returns | The shared data. |
| Description | Records the data to be shared in the callback. |
|---|---|
| Parameter | shared: The data to be shared. |
| Description | Iterator methods. The over() method must be called first to use these methods. |
|---|
| Description | Returns the element at the given index. If index is negative, the element relative to the end of the array is returned. Use -1 for the last element. |
|---|---|
| Parameter | index: The positional index of the element to return. |
| Returns | The new array. |
| Description | Appends the given array to the list of objects. |
|---|---|
| Parameter | elements: The array to be added to the original. |
| Returns | The new array. |
| Description | Returns true if all the elements of the array have a value that is matched by the callback function. The callback function must return true if the array element is a match. |
|---|---|
| Parameter | callback: The callback class to be invoked for each array element. |
| Returns | True if all the elements match. |
| Description | Builds a list of results matching the filter condition. The callback function must return true if the array element is to be added to the return list or false if not. |
|---|---|
| Parameter | callback: The callback class to be invoked for each array element. |
| Returns | List of filtered results. |
| Description | Calls the callback for each element in the array being iterated over. The currentValue argument to the callback function will be null. The return value from the callback function is ignored. |
|---|---|
| Parameter | callback: The callback class to be invoked for each array element. |
| Description | Returns a string comprised of the array elements joined by the separator. |
|---|---|
| Parameter | separator: Separator for array elements in output string. |
| Returns | The joined array elements. |
| Description | Returns the number of elements in the array. |
|---|---|
| Returns | The number of elements in the array. |
| Description | Removes the last element from the array and returns it. |
|---|---|
| Returns | The last element of the array. |
| Description | Adds the given object to the end of the array. |
|---|---|
| Parameter | obj: The object to add to the array. |
| Description | Calls the callback for each element in the array being iterated over. In the first call to the callback, the currentValue will be the first element of the array and the element argument will be the second element of the array. In subsequent calls, the currentValue will be the value returned by the last callback. |
|---|---|
| Parameter | callback: The callback class to be invoked for each array element. |
| Returns | The return value from the last element of the array iterated over. |
| Description | Builds an object based on the processing of each element of the array. The currentValue argument of the callback function will be the value of the initialValue argument for the iteration. In subsequent calls, the currentValue will be the last value returned by the callback's function() method. |
|---|---|
| Parameter | callback: The callback class to be invoked for each array element. |
| Parameter | initialValue: The starting value for the iteration. |
| Returns | The return value from the last element of the array iterated over. |
| Description | Calls the callback for each element in the array iterated over in reverse order. In the first call to the callback, the currentValue will be the last element of the array and the element argument will be the second to last element of the array. In subsequent calls, the currentValue will be the value returned by the last callback. |
|---|---|
| Parameter | callback: The callback class to be invoked for each array element. |
| Returns | The return value from the last element of the array iterated over. |
| Description | Builds an object based on the processing of each element of the array iterated over in reverse order. The currentValue argument of the callback function will be the value of the initialValue argument for the iteration. In subsequent calls, the currentValue will be the last value returned by the callback's function() method. |
|---|---|
| Parameter | callback: The callback class to be invoked for each array element. |
| Parameter | initialValue: The starting value for the iteration. |
| Returns | The return value from the last element of the array iterated over. |
| Description | Returns a new array with the elements of the original array in reversed order. |
|---|---|
| Returns | The new array with the reversed elements. |
| Description | Sets the data to be shared between callbacks. |
|---|---|
| Parameter | shared: The data to be shared between callbacks. |
| Returns | The Methods implementation, allowing the call to be chained with over(). |
| Description | Removes the first element from the array and returns it. |
|---|---|
| Returns | The first element of the array. |
| Description | Returns true if the array contains a value that is matched by the callback function. The callback function must return true if the array element is a match. |
|---|---|
| Parameter | callback: The callback class to be invoked for each array element. |
| Returns | True if a matching value is found. |
| Description | Sorts an array of Comparable objects. |
|---|---|
| Returns | A new array containing the sorted objects. |
| Description | Sorts an array using the given Comparable |
|---|---|
| Parameter | comparator: The Comparator to use to compare the objects. |
| Returns | A new array containing the sorted objects. |
| Description | Builds a list of objects with a transformation applied. This is the equivalent of the Javascript map() function. The callback function must apply the transformation and return the transformed object. The list returned will be of type ANY and as a result may not be cast to the type the list contains. |
|---|---|
| Parameter | callback: The callback class to be invoked for each array element. |
| Returns | The list of transformed objects. |
| Description | Builds a list of objects with a transformation applied. This is the equivalent of the Javascript map() function. The callback function must apply the transformation and return the transformed object. The return list must be of the type of the transformed elements. This allows the returned list to be cast to the type of the element. |
|---|---|
| Parameter | callback: The callback class to be invoked for each array element. |
| Parameter | returnList: The list of the type the transformed elements. |
| Returns | The list of transformed objects. |