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


< > BotCompany Repo | #1010892 - mapKeys - apply function to a map's keys

JavaX fragment (include)

static Map mapLike mapKeys(O func, Map map) {
  Map m = similarEmptyMap(map);
  for (O key : keys(map))
    m.put(callF(func, key), map.get(key));
  ret m;

static Map mapKeys(Map map, O func) {
  ret mapKeys(func, map);

static <A, B, C> Map<B, C> mapKeys(Map<A, C> map, IF1<A, B> func) {
  ret mapKeys(map, (O) func);

Author comment

Began life as a copy of #1004652

download  show line numbers  debug dex   

Travelled to 9 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1010892
Snippet name: mapKeys - apply function to a map's keys
Eternal ID of this version: #1010892/3
Text MD5: 8d3456417e0ce5479a524e7faf2a32c2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-07 14:16:13
Source code size: 338 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 211 / 218
Version history: 2 change(s)
Referenced in: [show references]

Formerly at &