sS getStringOpt(Map map, O key) { ret map == null ? null : optCast(S, map.get(key)); } sS getStringOpt(L l, int idx) { ret optCast(S, get(l, idx)); } sS getStringOpt(O o, O key) { if (o instanceof Map) ret getStringOpt((Map) o, key); if (key instanceof S) ret optCast(S, getOpt(o, (S) key)); throw fail("Not a string key: " + getClassName(key)); } sS mapMethodLike getStringOpt(S key, O o) { ret getStringOpt(o, (O) key); }
Began life as a copy of #1001954
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: | #1021916 | 
| Snippet name: | getStringOpt - getOpt with optional cast to string | 
| Eternal ID of this version: | #1021916/2 | 
| Text MD5: | c12e4860fcfaa71576ac6a45e1a1cb71 | 
| Author: | stefan | 
| Category: | |
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2019-03-03 16:15:40 | 
| Source code size: | 459 bytes / 18 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 531 / 585 | 
| Version history: | 1 change(s) | 
| Referenced in: | [show references] |