Class NetworkQueue<T>

java.lang.Object
technology.sola.engine.networking.NetworkQueue<T>
Type Parameters:
T - the type of the data

@NullMarked public class NetworkQueue<T> extends Object
NetworkQueue is a data structure for holding network messages in a first in first out basis.
  • Constructor Details

    • NetworkQueue

      public NetworkQueue()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns:
      true if there are no messages
    • size

      public int size()
      Returns:
      the number of messages in the queue
    • getFirst

      public T getFirst()
      Returns:
      the first message in the queue
    • getLast

      public T getLast()
      Returns:
      the last message in the queue
    • addFirst

      public void addFirst(T item)
      Adds message to the front of the queue.
      Parameters:
      item - the message to add
    • addLast

      public void addLast(T item)
      Adds a message to the end of the queue.
      Parameters:
      item - the message to add
    • clear

      public void clear()
      Clears all messages from the queue.
    • removeFirst

      public T removeFirst()
      Removes the first message from the queue and returns it.
      Returns:
      the first message in the queue
    • removeLast

      public T removeLast()
      Removes the last message from the queue and returns it.
      Returns:
      the last message in the queue