public static <K, V> Branched<K, V> withFunction(
            final Function<? super KStream<K, V>, ? extends KStream<K, V>> chain
    ) {
        Objects.requireNonNull(chain, "chain function cannot be null");
        return new Branched<>(null, chain, null);
    }
Create an instance of {@code Branched} with provided chain function.

@param chain
       A function that will be applied to the branch. If the provided function returns
       {@code null}, its result is ignored, otherwise it is added to the {@code Map} returned
       by {@link BranchedKStream#defaultBranch()} or {@link BranchedKStream#noDefaultBranch()} (see
       {@link BranchedKStream} description for details).

@param <K> key type
@param <V> value type

@return a new instance of {@code Branched}
streams/src/main/java/org/apache/kafka/streams/kstream/Branched.java