Interface QueueView<T>

All Superinterfaces:
Iterable<T>, View<T>
All Known Subinterfaces:
DequeView<T>
All Known Implementing Classes:
DequeViewImpl, EmptyDequeView, EmptyQueueView, QueueViewImpl

@API(status=STABLE) public interface QueueView<T> extends View<T>
A specialized View for Queue, which provides an additional set of functionality over the regular view access.
Since:
09/08/2022
  • Method Details

    • empty

      static <T> QueueView<T> empty()
      Creates an empty queue view for the given type which has no elements.
      Returns:
      An empty queue view for the given type which has no elements.
    • of

      @NotNull static <T> @NotNull QueueView<T> of(@NotNull @NotNull Queue<T> queue)
      Creates a new view instance which references the given Queue.
      Type Parameters:
      T - The element type of the given queue, and the newly created view.
      Parameters:
      queue - The queue of which to create a view.
      Returns:
      A new view instance, which references the given queue.
    • peek

      T peek()
      Retrieves the first element from the queue. Returns null if the queue is empty.
      Returns:
      The first element from the queue. Null if the queue is empty.