Constructors: NewArrayList |
Creates a new ArrayList object with the specified settings.
Public Function NewArrayList( Optional ByVal Comparer As IComparer, Optional ByRef Source As Variant ) As ArrayList
Sometimes the comparison of two items in the list cannot be accomplished by the default comparer that ArrayList uses. Cases like this may be when using different datatypes, UDTs, or objects that do not implement IComparable. In cases such as these, a custom comparer object may be supplied during the construction of an ArrayList. This comparer will be used as the default comparer for methods that require comparing items.
An ArrayList can be initialized with a default set of items. This is the same as creating a new ArrayList and using AddRange to add the items.
ArrayList accepts a VBA.Collection, ICollection, and an array as a list of items to initialize the new ArrayList to.
Dim MyItems(10) As Long Set list = NewArrayList(New MyComparer, MyItems)This will create a new ArrayList that uses MyComparer as the default comparer for the items. The ArrayList is also initialized with an array of Longs. The fully initialized ArrayList will have a count of 11 items, each item being a Long datatype with the value of 0.