ArraysListEx
Previous  Next

The ArrayListsEx object provides the following methods and properties. In particular it supports copying all or part of an ArrayLists content to normal arrays and adding the contents of normal arrays to an ArrayList.



Methods

AddArray(array As Array()) : Adds the contents of array to the end of the items (if any) already in the ArrayList.

BinarySearch(start As Int32, count as Int32, value As String, compare As Int32) : Performs a fast search for value in the ArrayList, examining count items from start index position. If value is not found a negative number is returned. If the absolute value of this number is greater than or equal to the size of the array, there are no elements larger than value in the array. Otherwise, it is the index of the first element that is larger than value. compare determines how the comparison is done. It may be cNumber, cCaseSensitive or cCaseUnsensitive and should be the same as was used to sort the array. The array must be sorted. Duplicate elements are allowed. If the Array contains more than one element equal to value, the method returns the index of only one of the occurrences, and not necessarily the first one.

CopyTo(aliststart As Int32, array As Array(), start As Int32, count As Int32) : Copies count number of elements of the ArrayList, starting at index position aliststart, to array, starting at index position start.

New1(arraylist As String, B4POject(1)) : Creates a new ArrayListsEx object and associates it with arraylist. If arraylist does not include a module name and the library is running under Basic4ppc version 6.50 or later then a default module name of "main" is assumed.

RemoveRange(start As Int32, count As Int32) : Remove count elements of the arraylist starting at index position start.

Reverse(start As Int32, count As Int32) : Reverses the order of count elements of the arraylist starting at index position start. Similar to the ArrayList Reverse except it allows operation on only a sub-set of the elements.

Sort(start As Int32, count As Int32, compare As Int32) : Sorts count elements of the arraylist starting at index position start. compare determines how the comparison is done. It may be cNumber, cCaseSensitive or cCaseUnsensitive. Similar to the ArrayList Sort except it allows operation on only a sub-set of the elements.

ToArray() : Returns an array containing copies of all the elements of the ArrayList.

TrimToSize : Sets the capacity to the actual number of elements in the ArrayList. This method can be used to minimize a collection's memory overhead if no new elements will be added to the collection. To reset a ArrayList to its initial state, call the Clear method before calling TrimToSize. Trimming an empty ArrayList sets the capacity of the ArrayList to the default capacity.



Properties
 
I signifies readable, O signifies settable.

Capacity : Int32 [I/O] : Gets or sets the number of elements that the ArrayList can contain. Capacity is the number of elements that the ArrayList can store. Count is the number of elements that are actually in the ArrayList. Capacity is always greater than or equal to Count. If Count exceeds Capacity while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements. When Clear is called on an ArrayList the Capacity remains unchanged. To reset the capacity of the ArrayList, call TrimToSize or set the Capacity property directly. Trimming an empty ArrayList sets the capacity of the ArrayList to the default capacity.

ControlRef : ArrayList [I] : Returns a reference to the ArrayList associated with this ArrayListsEx object.

Dllversion : Double [I] : Gets the version number of this library.