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

14
LINES

< > BotCompany Repo | #1021430 // getMapOpt

JavaX fragment (include)

1  
static Map getMapOpt(Map map, O key) {
2  
  ret map == null ? null : (Map) map.get(key);
3  
}
4  
5  
static Map getMapOpt(L l, int idx) {
6  
  ret (Map) get(l, idx);
7  
}
8  
9  
static Map getMapOpt(O o, O key) {
10  
  if (o instanceof Map) ret getMapOpt((Map) o, key);
11  
  if (key instanceof S)
12  
    ret (Map) getOpt(o, (S) key);
13  
  throw fail("Not a string key: " + getClassName(key));
14  
}

Author comment

Began life as a copy of #1003889

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021430
Snippet name: getMapOpt
Eternal ID of this version: #1021430/1
Text MD5: a43509bb9d936c3b8f08dc3c364df432
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-12 17:00:59
Source code size: 370 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 251 / 294
Referenced in: [show references]