i have the followig list and i want to delete the whole list and leave the last 4 items was inserted in the list based on some condition , is it possible ?
B4X:
dim Type cmdline(command as string)
dim CommandList As List
if CommandList.Size > 50 then
For i = 0 To CommandList.Size - 1
Dim cmd As cmdline
cmd = CommandList.Get(i)
'here i want to delete all items that contain something and leave the last 4 items inserted how can i possibly do that ?
If cmd.command = "something" Then
CommandList.RemoveAt(i)
End If
Next
End if