src/edu/kit/informatik/campusmanagement/CommandHandler.java
/**
     * Finds the required command for the given input.
     * Throws exception if there is ambiguity
     * @param string
     * @return
     */
Finds the required command for the given input.
Throws exception if there is ambiguity
@param string
@return
Finds the required command for the given input . Throws exception if there is ambiguity @param string @return
private Optional<C> find(String string) {
        return commands()
                .filter(cmd -> cmd.pattern().matcher(string).matches())
                .reduce((l, r) -> { 
                    throw new IllegalStateException("ambiguous: '" + string + "'"); 
                });
    }
private Optional < C > find ( String string ) { return commands ( ) . filter ( cmd -> cmd . pattern ( ) . matcher ( string ) . matches ( ) ) . reduce ( ( l , r ) -> { throw new IllegalStateException ( "ambiguous: '" + string + "'" ) ; } ) ; }
Finds the required command for the given input.
Finds the required command for the given input .
//TODO refactor into a single() extension method.  //The reduce API wasn't created for the used purpose