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

7
LINES

< > BotCompany Repo | #1016110 // lookup_first - lookup multiple keys in map, return first value found

JavaX fragment (include)

1  
static <A, B> B lookup_first(Map<A, B> map, A... keys) {
2  
  if (map != null && keys != null) for (A key : keys) {
3  
    B b = map.get(key);
4  
    if (b != null) ret b;
5  
  }
6  
  null;
7  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1016110
Snippet name: lookup_first - lookup multiple keys in map, return first value found
Eternal ID of this version: #1016110/2
Text MD5: 7f3765d83fb10db758207c81d4b62c3c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-06 12:45:23
Source code size: 182 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 441 / 452
Version history: 1 change(s)
Referenced in: [show references]