Libraryless. Click here for Pure Java version (3933L/22K).
static O[] mapToObjectArray(Map map) { new L l; for (O o : keys(map)) { l.add(o); l.add(map.get(o)); } ret toObjectArray(l); } static O[] mapToObjectArray(O f, Cl l) { int n = l(l); O[] array = new[n]; if (n != 0) { Iterator it = iterator(l); for i to n: array[i] = callF(f, it.next()); } ret array; } static O[] mapToObjectArray(O f, O[] l) { int n = l(l); O[] array = new[n]; for i to n: array[i] = callF(f, l[i]); ret array; } static <A> O[] mapToObjectArray(Cl<A> l, IF1<A, O> f) { ret mapToObjectArray(f, l); } static <A> O[] mapToObjectArray(A[] l, IF1<A, O> f) { ret mapToObjectArray(f, l); } static <A> O[] lambdaMapLike mapToObjectArray(IF1<A, O> f, A[] l) { int n = l(l); O[] array = new[n]; for i to n: array[i] = f.get(l[i]); ret array; } static <A> O[] lambdaMapLike mapToObjectArray(IF1<A, O> f, Cl<A> l) { int n = l(l); O[] array = new[n]; if (n != 0) { Iterator it = iterator(l); for i to n: array[i] = callF(f, it.next()); } ret array; }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1006543 |
Snippet name: | mapToObjectArray - interleave keys and values; also toObjectArray(map(...)) |
Eternal ID of this version: | #1006543/13 |
Text MD5: | 4ffae886d086cbbc3c2003168bccafe9 |
Transpilation MD5: | 96bba04744eb412fedc270621221eab1 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-13 18:54:41 |
Source code size: | 1105 bytes / 54 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 605 / 787 |
Version history: | 12 change(s) |
Referenced in: | [show references] |