I am having trouble understanding a code that is using an interface function but i don't seem to find the implementation for it. Is it possible to call an unimplemented interface function? The code is below, The class that calls the unimplemented function combineResults:
public final class Parallel {
public static <T> T For(int start, int end,
ParallelForDelegate<T> delegate, T input) {
T res = null;
for (int i = start; i < end; i++) {
res = delegate.combineResults(res, delegate.delegate(i, input));
}
return res;
}
}
The interface:
public interface ParallelForDelegate<T> {
public T delegate(int i, T input);
public T combineResults(T result1, T result2);
}
There has to be an implementation somewhere, but sometimes you can have a hard time finding it, because of various factories, dependecy injections, 'on-the-fly' building, ... mecanisms
On complex APIs like Hibernate, it can be tedious. However, the interface is supposed to give you enough details on its usage so you don't actually have to know how it's implemented.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments