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

14
LINES

< > BotCompany Repo | #1021430 // getMapOpt

JavaX fragment (include)

static Map getMapOpt(Map map, O key) {
  ret map == null ? null : (Map) map.get(key);
}

static Map getMapOpt(L l, int idx) {
  ret (Map) get(l, idx);
}

static Map getMapOpt(O o, O key) {
  if (o instanceof Map) ret getMapOpt((Map) o, key);
  if (key instanceof S)
    ret (Map) getOpt(o, (S) key);
  throw fail("Not a string key: " + getClassName(key));
}

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: 252 / 295
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)