B4R Library [module] Stack collection

An implementation of a stack (last in, first out) data collection.

Usage:
B4X:
Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   Stack.Push("Item 1")
   Stack.Push("Item 222")
   Stack.Push("Item 3333")
   Stack.Push("Item 44")
   Stack.Push("Item 555555")
   Stack.Pop
   Stack.Push("Item 612312")
   Stack.Push("Item 77777777777")
   Stack.Push("Item 88")
   Stack.Push("Item 99")
   Do While Stack.Size > 0
     Log(Stack.LastItem)
     Stack.Pop
   Loop
   Log("Size: ", Stack.Size)
End Sub
 

Attachments

  • Stack.zip
    1.4 KB · Views: 592

Cableguy

Expert
Licensed User
Longtime User
Why not group the 2 modules as they tackle similar tasks?
FIFO - First In First Out
LIFO - Last In First Out
 
Top