Libraryless. Click here for Pure Java version (5266L/29K).
static <A> O[] mapToArrayOrNull(A[] l, IF1<A, O> f) { if (l == null) null; int n = l.length; if (n == 0) null; O[] array = new[n]; for i to n: array[i] = f.get(l[i]); ret array; } static <A> O[] lambdaMapLike mapToArrayOrNull(IF1<A, O> f, A[] l) { ret mapToArrayOrNull(l, f); } static <A> O[] mapToArrayOrNull(IF1<A, O> f, Cl<A> l) { int n = l(l); if (n == 0) null; O[] array = new[n]; if (n != 0) { Iterator it = iterator(l); for i to n: array[i] = callF(f, it.next()); } ret array; } static <A> O[] mapToArrayOrNull(Cl<A> l, IF1<A, O> f) { ret mapToArrayOrNull(l, f); }
Began life as a copy of #1006543
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034772 |
| Snippet name: | mapToArrayOrNull |
| Eternal ID of this version: | #1034772/4 |
| Text MD5: | e8ae1eaa46f0c442574da11350aac45e |
| Transpilation MD5: | ada5490fcd6341d8362f5f98842822ff |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-08 07:29:02 |
| Source code size: | 650 bytes / 29 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 705 / 888 |
| Version history: | 3 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |