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);

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

Author comment

Began life as a copy of #1004652

download  show line numbers  debug dex   

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

No comments. add comment

Snippet ID: #1010892
Snippet name: mapKeys - apply function to a map's keys
Eternal ID of this version: #1010892/4
Text MD5: 4cb271d6640fd5b99b5bd3b2c3639011
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-13 12:57:43
Source code size: 439 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 226 / 238
Version history: 3 change(s)
Referenced in: [show references]

Formerly at &