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

12
LINES

< > BotCompany Repo | #1029675 // mapToCIMap - map a list to a ciMap using a function returning a pair

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

Transpiled version (2559L) is out of date.

static <A, B> TreeMap<S, B> lambdaMapLike mapToCIMap(IF1<A, Pair<S, B>> f, Iterable<A> l) {
  TreeMap<S, B> map = ciMap();
  fOr (A o : l) {
    Pair<S, B> p = f.get(o);
    map.put(p.a, p.b);
  }
  ret map;
}

static <A, B> TreeMap<S, B> mapToCIMap(Iterable<A> l, IF1<A, Pair<S, B>> f) {
  ret mapToCIMap(f, l);
}

Author comment

Began life as a copy of #1024294

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1029675
Snippet name: mapToCIMap - map a list to a ciMap using a function returning a pair
Eternal ID of this version: #1029675/2
Text MD5: b2b6fe3ef31391876e2f93cf212673d1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-07 12:13:54
Source code size: 327 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 135 / 215
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)