Filter ArrayList

RonQ

Freshman
Joined
Dec 11, 2003
Messages
28
Location
Argentina
I have this class that inherits an ArrayList, and I want to add a Filter Function, I want the method to return the same object (the inherited arraylist) with only some of the items depending on the value of property in the contained object that will be passed as a parameter, and I want the returned items to be the actual items of the arraylist, not a copy of them.

How could this be implemented? It's something like the Filter function in the datasource object.

This is my class:
Visual Basic:
Public Class cLineaArrayList
   Inherits ArrayList
   Default Public Shadows Property item(ByVal Index As Integer) As cLinea
      Get
         Return DirectCast(MyBase.Item(Index), cLinea)
      End Get
      Set(ByVal Value As cLinea)
         MyBase.Item(Index) = Value
      End Set
   End Property
   Public Shadows Sub Add(ByVal Value As cLinea)
      MyBase.Add(Value)
   End Sub

   'This is the function I want to create, but I don't know how to do..
   Public Function Filter(FilterIndex As Integer) as cLineaArrayList
      'I should have to scan all items and copy them, how?
   End Function
End Class

Thanks,
Ronq.
 
Back
Top