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)

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

download  show line numbers  debug dex   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lnbujpyubztb, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, whxojlpjdney, xfddqsrefgvo, 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: 514 / 2049
Version history: 1 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1001954 & http://1001954.tinybrain.de