资 源 简 介
With jcurry, methods can become curried functions. You mark a method with the annotation @AsFunction, and then you can use it in any collections method that takes a function*:
```
@AsFunction
private static int increment(int x)
{
return ++x;
}
@Test
public void testTransformList()
{
assertEquals(asList(2, 3), transform(asList(1, 2), increment));
}
You can also partially apply any method with more than one parameter:
@AsFunction
private static String concat(String prefix, int suffix)
{
return prefix + suffix;
}
@Test
public void testTransformListWithPartialApplication()
{
assertEquals(asList("Fred1", "Fred2"), transform(asList(1, 2), concat.apply("Fred")));
}
```
jcurry works with any instance method, static methods