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

18
LINES

< > BotCompany Repo | #1001954 - getString - getOpt with cast to string

JavaX fragment (include)

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

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

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

static S mapMethodLike getString(S key, O o) {
  ret getString(o, (O) key);
}

download  show line numbers  debug dex   

Travelled to 13 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lnbujpyubztb, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, tslmcundralx, tvejysmllsmz, whxojlpjdney, yanjaxplzisb

No comments. add comment

Snippet ID: #1001954
Snippet name: getString - getOpt with cast to string
Eternal ID of this version: #1001954/2
Text MD5: 839433f822ce07b6b439dadfe2eacf7c
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-23 23:15:23
Source code size: 441 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 421 / 1892
Version history: 1 change(s)
Referenced in: [show references]