Class Queues

java.lang.Object
it.unimi.di.prog2.h25.Queues

public class Queues extends Object
A collection of utilities related to Queuess.

This class provides Suppliers and wrappers to Queues to be used by the DiGraph.visit(Object, Consumer, java.util.function.Supplier) method.

  • Constructor Details

    • Queues

      private Queues()
  • Method Details

    • LIFOSupplier

      public static <T> Supplier<Queue<T>> LIFOSupplier()
      A Supplier of LIFO Queues.
      Type Parameters:
      T - the type of the graph nodes.
      Returns:
      the supplier.
    • FIFOSupplier

      public static <T> Supplier<Queue<T>> FIFOSupplier()
      A Supplier of FIFO Queues.
      Type Parameters:
      T - the type of the graph nodes.
      Returns:
      the supplier.
    • once

      public static <T> Queue<T> once(Queue<T> queue)
      Wraps a Queue making it a once queue.

      A once queue is a queue where every element can be added just once.

      Type Parameters:
      T - the type of the graph nodes.
      Parameters:
      queue - the queue to be wrapped.
      Returns:
      the wrapped queue.