A service interface declares two methods which apparently do the same processing :
interface Service<T> {
<R> R process(Function<? super T, ? extends R> function);
T process(UnaryOperator<T> operator);
}
The service above is being called like below :
void process(Service<CharSequence> service) {
service.process(sequence -> sequence.subSequence(0, 1));
}
Which one of the service methods are going to be called and why the compiler does not complain about an ambiguous call in this context?