It doesn't improve anything, but it makes my code more readable.
B4X:
Sub NewList As List
Dim newLst As List
newLst.Initialize
Return newLst
End Sub
Sub ListHas(data as String, listObj As List)
Return listObj.IndexOf(data) > -1
End Sub
Sub ListDoesNotHave(data as String, listObj As List)
Return listObj.IndexOf(data) == -1
End Sub
B4X:
Sub Implementation_Example
Dim myList = NewList As List
...
...
If ListHas(myList, "milk") Then
...
Else If ListDoesNotHave(myList, "eggs") Then
...
End If
End If
Last edited: