Hallo, ich habe ein Interface der Art
Nun würde ich das gerne noch erweitern:
Jetzt wird mir aber in beiden Fällen das vor dem Pfeil in der Lambda-Expression unterstrichen und es heißt "The target type of this expression must be a functional interface". Darf man sowas nicht machen, bzw wieso darf man das nicht oder mache ich da nur irgendwas falsch?
Java:
public interface Test<T extends AClass> {
boolean compare(T[] lhs, T[] rhs);
public static <T extends AClass> Test<T> compareAll() {
return (T[] lhs, T[] rhs) -> {
....
};
}
}
Java:
public interface Test<T extends AClass> {
boolean compare(T[] lhs, T[] rhs);
boolean compare(T lhs, T[] rhs);
public static <T extends AClass> Test<T> compareAll() {
return (T[] lhs, T[] rhs) -> {
....
};
}
public static <T extends AClass> Test<T> contains() {
return (T lhs, T[] rhs) -> {
....
};
}
}
Jetzt wird mir aber in beiden Fällen das vor dem Pfeil in der Lambda-Expression unterstrichen und es heißt "The target type of this expression must be a functional interface". Darf man sowas nicht machen, bzw wieso darf man das nicht oder mache ich da nur irgendwas falsch?
Zuletzt bearbeitet: