Hi Martin,
try something like:
return AccountList.stream().map(e -> e.getMendixObject()).collect(Collectors.toList());
Hope this helps,
Andrej
It's actually quite simple. Mendix always expects a list of List<IMendixObject> as a return value.
This gives you two options (that I know of).
1) Work with the input parameter list of IMendixObjects directly, and return this (probably better performance-wise, but you'd have to work with .getValue() / .setValue().
2) Work with the initialized list (as you are currently doing) and convert back to IMendixobjects for your return. This you'd do by creating a new list of IMendixObjects, iterating over your existing list, getting the IMendixObject for each, and returning your new list.
It'd look something like:
List<IMendixObject> returnList = new ArrayList<IMendixObject>();
for (Account a : AccountList) {
returnList.add(a.getMendixObject());
}
return returnList;
(Or using streams, for performance)