I’m trying to define a very simple function in Drools as below:
import java.util.List;
function int sumLengths(List<String> strings) {
int counter = 0;
for (String s : strings)
counter += s.length();
return counter;
}
but it gives me error:
Exception in thread "main" java.lang.RuntimeException: [ function sumLengths (line:5):
Unable to resolve type List<String> while building function. java.lang.ClassNotFoundException: Unable to find class 'List<String>' ]
any idea?
Perhaps it is an issue with generics (This points me to that conclusion). Have you tried the following (or similar):
If it doesn’t work you could use this instead: