1 | static O[] litparams(O... l) { |
2 | int n = 0, n1 = l(l); |
3 | for (int i = 0; i < n1; i += 2) |
4 | if (l[i] != null && l[i+1] != null) |
5 | ++n; |
6 | if (n == 0) null; |
7 | O[] params = new O[n*2]; |
8 | int j = 0; |
9 | for (int i = 0; i < n1; i += 2) { |
10 | O key = l[i], value = l[i+1]; |
11 | if (key != null && value != null) { |
12 | params[j++] = key; |
13 | params[j++] = value; |
14 | } |
15 | } |
16 | ret params; |
17 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021902 |
Snippet name: | litparams - make object array for params (key/value/key/value...), dropping null values |
Eternal ID of this version: | #1021902/1 |
Text MD5: | 2f38a3cacd15425aa75673a68b5f06f3 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-03 12:09:30 |
Source code size: | 403 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 362 / 381 |
Referenced in: | [show references] |