I just started looking at LambdaJ, and immediately ran into a problem. I don't think I am doing anything weird, yet I can't figure out how to do this.
I have a List of Administrators:
List<Administrator> allAdmins;
I have a map I want these Administrators to be mapped to:
Map<String, Administrator> adminIdToAdmin = new HashMap<String, Administrator>();
The problem is that IDs in the Administrator class are Longs, not Strings. So, I tried the following:
adminIdToAdmin = index(allAdmins, on(Administrator.class).getAdministratorId().toString());
which doesn't work. It fails with:
ch.lambdaj.function.argument.ArgumentConversionException: Unable to convert the placeholder -2147483647 in a valid argument
at ch.lambdaj.function.argument.ArgumentsFactory.actualArgument(ArgumentsFactory.java:92)
at ch.lambdaj.function.convert.ArgumentConverter.<init>(ArgumentConverter.java:29)
at ch.lambdaj.Lambda.index(Lambda.java:1133)
If I change my map to contain Longs and get rid of toString(), the error goes away.
What's the right way to do this?