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).

static L map_ping(Iterable l, O f) { ret map_ping(f, l); }

static L map_ping(O f, Iterable l) {
  L x = emptyList(l);
  if (l != null) for (O o : l)
    x.add(callF(f, o));
  ret x;
}

ifclass F1
  static <A, B> L<B> map_ping(Iterable<A> l, F1<A, B> f) { ret map_ping(f, l); }

  static <A, B> L<B> map_ping(F1<A, B> f, Iterable<A> l) {
    L x = emptyList(l);
    if (l != null) for (A o : l)
      x.add(callF(f, o));
    ret x;
  }
endif

static <A, B> L<B> map_ping(IF1<A, B> f, Iterable<A> l) { ret map_ping(l, f); }
static <A, B> L<B> map_ping(Iterable<A> l, IF1<A, B> f) {
  L x = emptyList(l);
  if (l != null) for ping (A o : l)
    x.add(f.get(o));
  ret x;
}
  
static <A, B> L<B> map_ping(IF1<A, B> f, A[] l) { ret map_ping(l, f); }
static <A, B> L<B> map_ping(A[] l, IF1<A, B> f) {
  L x = emptyList(l);
  if (l != null) for ping (A o : l)
    x.add(f.get(o));
  ret x;
}
  
static L map_ping(O f, O[] l) { ret map_ping(f, asList(l)); }
static L map_ping(O[] l, O f) { ret map_ping(f, l); }

static L map_ping(O f, Map map) {
  ret map_ping(map, f);
}

// map_ping: func(key, value) -> list element
static L map_ping(Map map, O f) {
  new L x;
  if (map != null) for ping (O _e : map.entrySet()) {
    Map.Entry e = (Map.Entry) _e;
    x.add(callF(f, e.getKey(), e.getValue()));
  }
  ret x;
}

static <A, B, C> L<C> map_ping(Map<A, B> map, IF2<A, B, C> f) {
  ret map_ping(map, (O) f);
}

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: 132 / 212
Referenced in: [show references]