Press on the image to return to the main documentation page.
CollectionsExtra
Written by Andrew Graham
This library provides an implementation of a doubly linked list that can be used as a stack, queue, or double-ended queue.
It also includes an ArraysExtra object that allows arrays to be partially or full copied, cloned, partially or fully filled with a given value, sorted and searched. ArraysExtra can also return, using the ToString method, a comma separated string representation of the contents of an array of Strings or a primitive type.
This ArraysExtra object allows arrays to be partially or fully copied, cloned, partially or fully filled with a given value, sorted and searched. It can also return, using the ToString method, a comma separated string representation of the contents of an array of Strings or a primitive type.
Copies all or a section of one array to another existing array of sufficient size to accept the copied items. The arrays need to be same type otherwise an ArrayStoreException is thrown.
BinarySearch (arrayAsObject, valueAsObject) AsInt
Searches the specified array for the specified value using the binary search algorithm. The array must be sorted into ascending order according to the natural ordering of its elements, as by the Sort() method, prior to making this call. If it is not sorted, the results are undefined. The array must be a single dimension array of Strings or a primitive type.
Clone (arrayAsObject) AsObject
Returns a clone, that is a copy, of the specified array. The array must be a single dimension array of Strings or a primitive type.
Fill (arrayAsObject, startAsInt, lenAsInt, valueAsObject)
Fully or partially fills the specified array with the specified value. The array must be a single dimension array of Strings or a primitive type.
SORTCASEINSENSITIVEAsInt
SORTCASESENSITIVEAsInt
SORTNUMERICAsInt
SortNumericArray (arrayAsObject)
Sorts the specified array of primitive numeric types into ascending numerical order.
SortStringArray (arrayAsObject, comparisonAsInt)
Sorts the specified array of Strings into ascending order according to the specified comparison. Note that for use with BinarySearch SORTCASESENSITIVE should be used otherwise the result may not be accurate.
ToString (arrayAsObject) AsString
Returns a string representation of the contents of the specified array. The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space).
The LinkedList object provides uniformly named methods to get, remove and insert an element at the beginning and end of the list. These operations allow linked lists to be used as a stack, queue, or double-ended queue. All of the operations perform as would be expected for a doubly-linked list. Operations that index into the list will traverse the list from the beginning or the end, whichever is closer to the specified index.
Appends the specified element to the end of this list.
AddAll (listAsList)
Adds all elements in the specified collection to the end of the list. Note that you can add an array directly.
AddAllAt (indexAsInt, listAsList)
Inserts all the elements in the specified collection into the list starting at the specified index. Note that you can insert an array directly.
AddFirst (itemAsObject)
Inserts the specified element at the beginning of this list.
AddLast (itemAsObject)
Appends the specified element to the end of this list.
Clear
Removes all of the elements from this list.
FirstAsObject [read only]
Retrieves, but does not remove, the first element of this list, or returns null if this list is empty.
Get (indexAsInt) AsObject
Returns the element at the specified position in this list.
IndexOf (itemAsObject) AsInt
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Initialize
Initializes an empty linked list.
Initialize2 (listorarrayAsList)
Initializes a list with the given values. This method should be used to convert arrays to linked lists.
InsertAt (indexAsInt, valueAsObject)
Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
IsInitializedAsBoolean
LastAsObject [read only]
Retrieves, but does not remove, the last element of this list, or returns null if this list is empty.
RemoveAt (indexAsInt) AsObject
Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
RemoveFirstAsObject
Removes and returns the first element from this list.
RemoveLastAsObject
Removes and returns the last element from this list.
Replace (indexAsInt, itemAsObject) AsObject
Replaces the element at the specified position in this list with the specified element.
Reverse
Reverses the order of the elements in the specified list. This method runs in linear time.
SizeAsInt [read only]
Returns the number of elements in this list.
Sort (AscendingAsBoolean)
Sorts the list. The items must all be numbers or strings.
SortCaseInsensitive (AscendingAsBoolean)
Lexicographically sorts the list, ignoring the characters case. The items must all be numbers or strings.
Swap (index1AsInt, index2AsInt)
Swaps the elements at the specified positions in the specified list. If the specified positions are equal, invoking this method leaves the list unchanged.