Skip to content

Commit e42d325

Browse files
committed
Add Func helpe
1 parent 4d8d654 commit e42d325

File tree

1 file changed

+19
-0
lines changed
  • src/AndroidClient/client/src/main/java/net/servicestack/client

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package net.servicestack.client;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class Func {
7+
public static interface Function<T,R> {
8+
public R apply(T t);
9+
}
10+
11+
public static <T,R> ArrayList<R> map(List<T> xs, Function<T,R> f) {
12+
ArrayList<R> to = new ArrayList<>();
13+
for (T x : xs) {
14+
R ret = f.apply(x);
15+
to.add(ret);
16+
}
17+
return to;
18+
}
19+
}

0 commit comments

Comments
 (0)