Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

56
LINES

< > BotCompany Repo | #1027913 // map_ping - map + ping [dev.]

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2523L/16K).

1  
static L map_ping(Iterable l, O f) { ret map_ping(f, l); }
2  
3  
static L map_ping(O f, Iterable l) {
4  
  L x = emptyList(l);
5  
  if (l != null) for (O o : l)
6  
    x.add(callF(f, o));
7  
  ret x;
8  
}
9  
10  
ifclass F1
11  
  static <A, B> L<B> map_ping(Iterable<A> l, F1<A, B> f) { ret map_ping(f, l); }
12  
13  
  static <A, B> L<B> map_ping(F1<A, B> f, Iterable<A> l) {
14  
    L x = emptyList(l);
15  
    if (l != null) for (A o : l)
16  
      x.add(callF(f, o));
17  
    ret x;
18  
  }
19  
endif
20  
21  
static <A, B> L<B> map_ping(IF1<A, B> f, Iterable<A> l) { ret map_ping(l, f); }
22  
static <A, B> L<B> map_ping(Iterable<A> l, IF1<A, B> f) {
23  
  L x = emptyList(l);
24  
  if (l != null) for ping (A o : l)
25  
    x.add(f.get(o));
26  
  ret x;
27  
}
28  
  
29  
static <A, B> L<B> map_ping(IF1<A, B> f, A[] l) { ret map_ping(l, f); }
30  
static <A, B> L<B> map_ping(A[] l, IF1<A, B> f) {
31  
  L x = emptyList(l);
32  
  if (l != null) for ping (A o : l)
33  
    x.add(f.get(o));
34  
  ret x;
35  
}
36  
  
37  
static L map_ping(O f, O[] l) { ret map_ping(f, asList(l)); }
38  
static L map_ping(O[] l, O f) { ret map_ping(f, l); }
39  
40  
static L map_ping(O f, Map map) {
41  
  ret map_ping(map, f);
42  
}
43  
44  
// map_ping: func(key, value) -> list element
45  
static L map_ping(Map map, O f) {
46  
  new L x;
47  
  if (map != null) for ping (O _e : map.entrySet()) {
48  
    Map.Entry e = (Map.Entry) _e;
49  
    x.add(callF(f, e.getKey(), e.getValue()));
50  
  }
51  
  ret x;
52  
}
53  
54  
static <A, B, C> L<C> map_ping(Map<A, B> map, IF2<A, B, C> f) {
55  
  ret map_ping(map, (O) f);
56  
}

Author comment

Began life as a copy of #1003239

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027913
Snippet name: map_ping - map + ping [dev.]
Eternal ID of this version: #1027913/1
Text MD5: 10047827b6a1e74cd924667f61e5115d
Transpilation MD5: cd2e03f860c07c75db9e4f1778b53f2b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-17 00:28:22
Source code size: 1457 bytes / 56 lines
Pitched / IR pitched: No / No
Views / Downloads: 209 / 309
Referenced in: [show references]