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   

Travelled to 5 computer(s): bhatertpkbcr, mqqgnosmbjvj, pzhvpgtvlbxg, tvejysmllsmz, 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: 57 / 96
Version history: 3 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1024295 & http://1024295.tinybrain.de