Interface Graph.Builder<T>

  • Type Parameters:
    T - Node type.
    Enclosing interface:
    Graph<T>

    @NonExtendable
    public static interface Graph.Builder<T>
    Graph builder.
    • Method Detail

      • allowSelfLoops

        @Contract("-> this")
        @NotNull
        @NotNull Graph.Builder<T> allowSelfLoops()
        Allow self-loops.
        Returns:
        this.
      • allowSelfLoops

        @Contract("_ -> this")
        @NotNull
        @NotNull Graph.Builder<T> allowSelfLoops​(boolean allowSelfLoops)
        Sets whether this graph should allow self-loops.

        Attempting to add a self-loop to a graph with self-loops not allowed will cause an IllegalArgumentException to be thrown.

        Defaults to false.

        Parameters:
        allowSelfLoops - Whether self-loops should be allowed.
        Returns:
        this.
      • build

        @Contract(value="-> new",
                  pure=true)
        @NotNull
        @NotNull Graph<T> build()
        Build graph.
        Returns:
        new graph.