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

16
LINES

< > BotCompany Repo | #1004134 // putKeysFirst - convert Map to litorderedmap with specified keys in front

JavaX fragment (include)

static Map putKeysFirst(Map map, O... keys) {
  Map m2 = litorderedmap();
  Map remaining = cloneMap(map);
  for (O key : keys) {
    if (remaining.containsKey(key)) {
      m2.put(key, remaining.get(key));
      remaining.remove(key);
    }
  }
  m2.putAll(remaining);
  ret m2;
}

static Map putKeysFirst(L keys, Map map) {
  ret putKeysFirst(map, toObjectArray(keys));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004134
Snippet name: putKeysFirst - convert Map to litorderedmap with specified keys in front
Eternal ID of this version: #1004134/3
Text MD5: 1e4a5c3f28bd9227c7c32abc53631c35
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-07 14:30:16
Source code size: 388 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 616 / 614
Version history: 2 change(s)
Referenced in: [show references]