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 (2555L/16K).

static L syncMap(O f, Map map) {
  ret syncMap(map, f);
}

// map: func(key, value) -> list element
static L syncMap(Map map, O f) {
  ret map(cloneLinkedHashMap(map), f); // TODO: use a temporary list instead
}

static <A, B> Map<A, B> syncMap() {
  ret synchroHashMap();
}

static <A, B> Map<A, B> syncMap(Map map) {
  ret synchronizedMap(map);
}

download  show line numbers  debug dex   

Travelled to 11 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pzhvpgtvlbxg, tvejysmllsmz, 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: b72ee1917d2ce4d1f683f105b464aaee
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: 110 / 148
Version history: 6 change(s)
Referenced in: [show references]

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