tlist_reverse.bmx 419 B

12345678910111213141516171819202122232425
  1. SuperStrict
  2. Framework Brl.LinkedList
  3. Import Brl.StandardIO
  4. ' create a list to hold some objects
  5. Local list:TList = New TList
  6. ' add some string objects to the end of the list
  7. list.AddLast("one")
  8. list.AddLast("two")
  9. list.AddLast("three")
  10. ' reverse the list
  11. list.Reverse()
  12. ' enumerate all the strings in the list
  13. For Local a:String = EachIn list
  14. Print a
  15. Next
  16. ' outputs:
  17. ' three
  18. ' two
  19. ' one