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

10
LINES

< > BotCompany Repo | #1032571 // rgenget - generic get (field/map value) with reverse syntax

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3842L/22K).

1  
sO mapMethodLike rgenget(O key, O o) {
2  
  o = deref(o);
3  
  if (o cast Map) {
4  
    try object mapGet(o, key);
5  
    if (key instanceof Int)
6  
      try object mapGet(o, toLong(key));
7  
  } else if (key cast S)
8  
    ret getOpt(o, key);
9  
  null;
10  
}

Author comment

Began life as a copy of #1024793

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032571
Snippet name: rgenget - generic get (field/map value) with reverse syntax
Eternal ID of this version: #1032571/6
Text MD5: a34e47a626bc03a632d9162efcdce0ab
Transpilation MD5: 79986c1419cd473219f3850a36dd3a7f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-04 05:12:16
Source code size: 242 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 201 / 315
Version history: 5 change(s)
Referenced in: [show references]