On Jan 31, 2009, at 8:01 PM, Kem Tekinay wrote:
On 1/31/09 3:45 PM, "Charles Yeomans" <charles@declareSub.com> wrote:
Someone else suggested using a Dictionary object. I suggest using it
as follows.
Function RemoveDuplicates(theList() as Integer) as Integer()
dim d as new Dictionary
dim newList() as Integer
for i as Integer = 0 to UBound(theList)
if not d.HasKey(theList(i)) then
newList.Append theList(i)
d.Value(theList(i) = nil
end if
next
return newList
End Function
It probably would be faster to predimension the array, especially
for large
arrays. (And, this is supposed to be for strings.)
I expect it would. But that's not what I was optimizing for :)
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|