Transpiled version (2481L) is out of date.
1 | static String unnull(String s) { |
2 | return s == null ? "" : s; |
3 | } |
4 | |
5 | static <A> Collection<A> unnull(Collection<A> l) { |
6 | ret l == null ? emptyList() : l; |
7 | } |
8 | |
9 | static <A> L<A> unnull(L<A> l) { ret l == null ? emptyList() : l; } |
10 | static int[] unnull(int[] l) { ret l == null ? emptyIntArray() : l; } |
11 | static char[] unnull(char[] l) { ret l == null ? emptyCharArray() : l; } |
12 | static double[] unnull(double[] l) { ret l == null ? emptyDoubleArray() : l; } |
13 | |
14 | static <A, B> Map<A, B> unnull(Map<A, B> l) { |
15 | ret l == null ? emptyMap() : l; |
16 | } |
17 | |
18 | static <A> Iterable<A> unnull(Iterable<A> i) { |
19 | ret i == null ? emptyList() : i; |
20 | } |
21 | |
22 | static <A> A[] unnull(A[] a) { |
23 | ret a == null ? (A[]) emptyObjectArray() : a; |
24 | } |
25 | |
26 | static BitSet unnull(BitSet b) { |
27 | ret b == null ? new BitSet() : b; |
28 | } |
29 | |
30 | ifclass Pt |
31 | static Pt unnull(Pt p) { |
32 | ret p == null ? new Pt : p; |
33 | } |
34 | endif |
35 | |
36 | //ifclass Symbol |
37 | ifndef SymbolAsString |
38 | static Symbol unnull(Symbol s) { |
39 | ret s == null ? emptySymbol() : s; |
40 | } |
41 | //endif |
42 | endifndef |
43 | |
44 | ifclass Pair |
45 | static <A, B> Pair<A, B> unnull(Pair<A, B> p) { |
46 | ret p != null ? p : Pair(null, null); |
47 | } |
48 | endif |
49 | |
50 | static long unnull(Long l) { ret l == null ? 0L : l; } |
Began life as a copy of #2000506
download show line numbers debug dex
Travelled to 20 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, jcllbfdqhrgy, lpdgvwnxivlt, mqqgnosmbjvj, omdjrrnzbjjv, onxytkatvevr, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, whxojlpjdney, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1001913 |
Snippet name: | unnull |
Eternal ID of this version: | #1001913/18 |
Text MD5: | 93f6cc07e01156df88786016eff29409 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-10-29 10:32:16 |
Source code size: | 1185 bytes / 50 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 509 / 6954 |
Version history: | 17 change(s) |
Referenced in: | [show references] |
Formerly at http://tinybrain.de/1001913 & http://1001913.tinybrain.de