Transpiled version (78L) is out of date.
1 | sbool contains(Collection c, O o) { |
2 | ret c != null && c.contains(o); |
3 | } |
4 | |
5 | sbool contains(Iterable it, O a) { |
6 | if (it != null) |
7 | for (O o : it) |
8 | if (eq(a, o)) |
9 | true; |
10 | false; |
11 | } |
12 | |
13 | static bool contains(O[] x, O o) { |
14 | if (x != null) |
15 | for (O a : x) |
16 | if (eq(a, o)) |
17 | true; |
18 | false; |
19 | } |
20 | |
21 | static bool contains(S s, char c) { |
22 | ret s != null && s.indexOf(c) >= 0; |
23 | } |
24 | |
25 | static bool contains(S s, S b) { |
26 | ret s != null && s.indexOf(b) >= 0; |
27 | } |
28 | |
29 | static bool contains(BitSet bs, int i) { |
30 | ret bs != null && bs.get(i); |
31 | } |
32 | |
33 | ifclass Producer |
34 | static <A> bool contains(Producer<A> p, A a) { |
35 | if (p != null && a != null) while true { |
36 | A x = p.next(); |
37 | if (x == null) break; |
38 | if (eq(x, a)) true; |
39 | } |
40 | false; |
41 | } |
42 | endif |
43 | |
44 | ifclass Rect |
45 | sbool contains(Rect r, Pt p) { ret rectContains(r, p); } |
46 | endif |
Began life as a copy of #1002148
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1002990 |
Snippet name: | contains - like Collection.contains, but allows a null collection and arrays. also for strings |
Eternal ID of this version: | #1002990/12 |
Text MD5: | db3968ea2d42c016ad55261ff7be5e81 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-25 20:00:04 |
Source code size: | 852 bytes / 46 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 936 / 1806 |
Version history: | 11 change(s) |
Referenced in: | [show references] |