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

12
LINES

< > BotCompany Repo | #1007833 // multiMapPut - multimap put in normal Map; also: put in MultiMap if key & value are not null

JavaX fragment (include)

1  
static <A, B> void multiMapPut(Map<A, L<B>> map, A a, B b) {
2  
  L<B> l = map.get(a);
3  
  if (l == null)
4  
    map.put(a, l = new L);
5  
  l.add(b);
6  
}
7  
8  
ifclass MultiMap
9  
static <A, B> void multiMapPut(MultiMap<A, B> mm, A key, B value) {
10  
  if (mm != null && key != null && value != null) mm.put(key, value);
11  
}
12  
endif

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007833
Snippet name: multiMapPut - multimap put in normal Map; also: put in MultiMap if key & value are not null
Eternal ID of this version: #1007833/5
Text MD5: 512f6115c52d955a02e5fa72dc863237
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-10 21:10:39
Source code size: 316 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 608 / 690
Version history: 4 change(s)
Referenced in: [show references]