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

18
LINES

< > BotCompany Repo | #1018901 // getList - getOpt with cast to List

JavaX fragment (include)

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

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

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

static L mapMethodLike getList(S name, O o) {
  ret getList(o, name);
}

Author comment

Began life as a copy of #1001954

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018901
Snippet name: getList - getOpt with cast to List
Eternal ID of this version: #1018901/3
Text MD5: 9db0d291fba89a0407ad50c6dfa7ceac
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-20 14:19:26
Source code size: 427 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 370 / 424
Version history: 2 change(s)
Referenced in: [show references]