org.op4j.functions.Call is a special functions class which allows the execution of a method in the target object.
Here is an example: Imagine your application has a User class which contains a getName() method, returning a String. Let's get the names of all the users in a list:
List<User> users = ...;
List<String> userNames = Op.on(users).map(Call.methodForString("getName")).get();
The methodForX(...) methods in the Call class return the following functions:
| Method | Returned function type |
| methodForBigDecimal(...) | Function<Object,BigDecimal> |
| methodForBigInteger(...) | Function<Object,BigInteger> |
| methodForBoolean(...) | Function<Object,Boolean> |
| methodForByte(...) | Function<Object,Byte> |
| methodForCalendar(...) | Function<Object,Calendar> |
| methodForCharacter(...) | Function<Object,Character> |
| methodForDate(...) | Function<Object,Date> |
| methodForDouble(...) | Function<Object,Double> |
| methodForFloat(...) | Function<Object,Float> |
| methodForInteger(...) | Function<Object,Integer> |
| methodForLong(...) | Function<Object,Long> |
| methodForObject(...) | Function<Object,Object> |
| methodForShort(...) | Function<Object,Short> |
| methodForString(...) | Function<Object,String> |
| methodFor(Type<T>,...) | Function<Object,T> |
Every methodForX(...) method can be passed parameters, and these have to correspond with the parameters of the method being called.
List<User> users = ...;
Group group = ...;
...
List<User> usersInGroup =
Op.on(users).removeAllFalse(Call.methodForBoolean("isInGroup", group).get();