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

21
LINES

< > BotCompany Repo | #1024295 // mapToOrderedMap

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

Transpiled version (2533L) is out of date.

static LinkedHashMap mapLike mapToOrderedMap(O f, Iterable l) {
  new LinkedHashMap map;
  fOr (O o : l) {
    Pair p = cast callF(f, o);
    map.put(p.a, p.b);
  }
  ret map;
}

static <A, B, C> LinkedHashMap<B, C> mapLike mapToOrderedMap(IF1<A, Pair<B, C>> f, Iterable<A> l) {
  new LinkedHashMap<B, C> map;
  fOr (A o : l) {
    Pair<B, C> p = callF(f, o);
    map.put(p.a, p.b);
  }
  ret map;
}

static <A, B, C> LinkedHashMap<B, C> mapToOrderedMap(Iterable<A> l, IF1<A, Pair<B, C>> f) {
  ret mapToOrderedMap(f, l);
}

Author comment

Began life as a copy of #1024294

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: #1024295
Snippet name: mapToOrderedMap
Eternal ID of this version: #1024295/4
Text MD5: 52736ed829451bb5d4e5d1beb351a025
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-25 13:04:30
Source code size: 543 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 272 / 392
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)