I tried it this way but all I get is this Error Message: java: incompatible types: E cannot be converted to int
public static<E extends Comparable<?superE>> Optional<E> min(List<E>list) {
int result = reduce(list, 0, (a, l) -> a.compareTo((int)l) <= 0 ? a:(int)l);
return (Optional<E>) Optional.of(result);
}
I really don't know how to solve this.