src/edu/kit/informatik/campusmanagement/Grade.java
/**
     * Returns the average grade for the provided arguments.
     * 
     * <p>If the weighting function returns non-positive values, the result of this method is undefined.
     * 
     * @param  <T> type parameter of the values
     * @param  values a stream of values
     * @param  function a function to convert a value to a grade
     * @param  weighting a function to convert a value to a weighting
     * @return the average grade
     */
Returns the average grade for the provided arguments.

If the weighting function returns non-positive values, the result of this method is undefined.


Returns the average grade for the provided arguments . If the weighting function returns non - positive values the result of this method is undefined .
public static <T> Grade average(
            final Stream<T> values,
            final Function<T, Grade> function,
            final ToIntFunction<T> weighting) {
        Objects.requireNonNull(function);
        Objects.requireNonNull(weighting);
        return values.map(t -> Node.of(function.apply(t), weighting.applyAsInt(t)))
                .reduce(Node.IDENTITY, Node::add).asGrade();
    }
public static < T > Grade average ( final Stream < T > values , final Function < T , Grade > function , final ToIntFunction < T > weighting ) { Objects . requireNonNull ( function ) ; Objects . requireNonNull ( weighting ) ; return values . map ( t -> Node . of ( function . apply ( t ) , weighting . applyAsInt ( t ) ) ) . reduce ( Node . IDENTITY , Node :: add ) . asGrade ( ) ; }
Returns the average grade for the provided arguments.
Returns the average grade for the provided arguments .
////