Public Class Zet As Vector
'declarations
Private pValues As Vector
'/**
' * Constructor.
' */
Public Sub New()
Set Me.pValues = New Vector()
End Sub
'/**
' * Adds only unique elements.
' */
Public Sub AddElement(d As Variant)
'see if the vector contains this element already
If Not Me.pValues.Contains(d.UniversalID) Then
Call Vector..AddElement(d)
Call Me.pValues.AddElement(d.UniversalID)
End If
End Sub
Public Function Size() As Integer
Size = Vector..Size()
End Function
Public Function Elements() As Enumeration
Set Elements = Vector..Elements()
End Function
End Class
2 thoughts on “Zet (Set) class in LotusScript”
Comments are closed.
Isn’t your addElement method hardcoded for NotesDocuments, since you are using d.UniversalID? Isn’t it better to override the contains (actually the indexOf) method, so that you can test if any of the UNIDs already have been added?
Thanks for the bug report btw 😀
Yes – probably… I did the Zet to solve a concrete problem that had to do with looping a collection multiple times and needed to capture unique documents but the code should be made generic.