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.

1  
static LinkedHashMap mapLike mapToOrderedMap(O f, Iterable l) {
2  
  new LinkedHashMap map;
3  
  fOr (O o : l) {
4  
    Pair p = cast callF(f, o);
5  
    map.put(p.a, p.b);
6  
  }
7  
  ret map;
8  
}
9  
10  
static <A, B, C> LinkedHashMap<B, C> mapLike mapToOrderedMap(IF1<A, Pair<B, C>> f, Iterable<A> l) {
11  
  new LinkedHashMap<B, C> map;
12  
  fOr (A o : l) {
13  
    Pair<B, C> p = callF(f, o);
14  
    map.put(p.a, p.b);
15  
  }
16  
  ret map;
17  
}
18  
19  
static <A, B, C> LinkedHashMap<B, C> mapToOrderedMap(Iterable<A> l, IF1<A, Pair<B, C>> f) {
20  
  ret mapToOrderedMap(f, l);
21  
}

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: 273 / 394
Version history: 3 change(s)
Referenced in: [show references]