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

20
LINES

< > BotCompany Repo | #1032620 // mapToMap_pcall - mapToMap + pcall

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

Libraryless. Click here for Pure Java version (3963L/23K).

1  
static <A, B, C> Map<B, C> lambdaMapLike mapToMap_pcall(IF1<A, Pair<B, C>> f, Iterable<A> l) {
2  
  new Map<B, C> map;
3  
  fOr (A o : l) pcall {
4  
    Pair<B, C> p = callF(f, o);
5  
    map.put(p.a, p.b);
6  
  }
7  
  ret map;
8  
}
9  
10  
static <A, B, C> Map<B, C> mapToMap_pcall(Iterable<A> l, IF1<A, Pair<B, C>> f) {
11  
  ret mapToMap_pcall(f, l);
12  
}
13  
14  
/*static <A, B, C, D> Map<C, D> mapToMap(Map<A, B> m, IF2<A, B, Pair<C, D>> f) {
15  
  ret mapMapToMap(f, m);
16  
}
17  
18  
static <A, B, C, D> Map<C, D> mapToMap(IF2<A, B, Pair<C, D>> f, Map<A, B> m) {
19  
  ret mapMapToMap(f, m);
20  
}*/

Author comment

Began life as a copy of #1024294

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032620
Snippet name: mapToMap_pcall - mapToMap + pcall
Eternal ID of this version: #1032620/1
Text MD5: b239572c77f9ce8cb763cb48d5a2d18a
Transpilation MD5: 484c27e290a7d65d745736e7aaf43e87
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-29 18:14:42
Source code size: 560 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 163 / 223
Referenced in: [show references]