Class Consumers

java.lang.Object
it.unimi.di.prog2.h25.digraph.Consumers

public class Consumers extends Object
A collection of Consumers to be used in graph visits.

This class provides some Consumers to be used by the DiGraph.visit(Object, Consumer, java.util.function.Supplier) method.

  • Constructor Details

    • Consumers

      private Consumers()
  • Method Details

    • printConsumer

      public static <T> Consumer<T> printConsumer()
      A Consumer printing to the standard output every visited node.
      Type Parameters:
      T - the type of the graph nodes.
      Returns:
      the consumer.
    • collectConsumer

      public static <T> Consumer<T> collectConsumer(Collection<T> result)
      A Consumer that adds the visited nodes in the given Collection.
      Type Parameters:
      T - the type of the graph nodes.
      Parameters:
      result - here will be added the visited nodes.
      Returns:
      the consumer.