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

16
LINES

< > BotCompany Repo | #1019135 // syncMap - clone map and map over that; also: make a synchronized HashMap (or other map)

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

Libraryless. Click here for Pure Java version (2610L/16K).

1  
static L syncMap(O f, Map map) {
2  
  ret syncMap(map, f);
3  
}
4  
5  
// map: func(key, value) -> list element
6  
static L syncMap(Map map, O f) {
7  
  ret map(cloneLinkedHashMap(map), f); // TODO: use a temporary list instead
8  
}
9  
10  
static <A, B> Map<A, B> syncMap() {
11  
  ret synchroHashMap();
12  
}
13  
14  
static <A, B> Map<A, B> syncMap(Map map) {
15  
  ret synchronizedMap(map);
16  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1019135
Snippet name: syncMap - clone map and map over that; also: make a synchronized HashMap (or other map)
Eternal ID of this version: #1019135/7
Text MD5: fa2a77a9ad6889872b5b387add2fa553
Transpilation MD5: 16a0016494ebeddbcf852f8966e11489
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-15 01:09:41
Source code size: 363 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 369 / 519
Version history: 6 change(s)
Referenced in: [show references]