Using Collections.Queue
 
 Public Sub QueueTest()
      Dim qx As New System.Collections.Queue
      Dim o() As Object = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}
      Dim x As Integer = 0
      qx.Enqueue("Dog")
      qx.Enqueue("Cat")
      qx.Enqueue("Rat")
      qx.Enqueue("Mouse")
      qx.Enqueue("Hat")
      qx.Enqueue(Me)
      qx.Enqueue(5)
      qx.Enqueue(7.14)
      Dim cnt As Integer = qx.Count
      Dim bl As Boolean = qx.Contains("Mouse")
      Do Until qx.Count = 0
         o(x) = qx.Dequeue()
         Stop ' results in your locals window
         x += 1
      Loop
   End Sub
 
 

Queues were indispensible in low level assembly language. They are similar to a line (or queue) at a theater or supermarket. First in line is served first. An assembly language program that I used to work on would put pointers to subroutines on the queue depending on their priority. That way the one with top priority would get executed first. Usually they were put on the list according to time, but occasionally a super-important routine would get put on before other less important ones. Kind of like the mayor coming to the theater and getting preferential treatment.

The object array o() is just to show the order in which they are dequeued. Its not necessary to the example.

10/04/2015
TheLonelyProgrammer.Net
Alone in a sea of non-programmers
Home ArrayList 1 ArrayList 2 Queues Stacks