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)

static <A, B> void multiMapPut(Map<A, L<B>> map, A a, B b) {
  L<B> l = map.get(a);
  if (l == null)
    map.put(a, l = new L);
  l.add(b);
}

ifclass MultiMap
static <A, B> void multiMapPut(MultiMap<A, B> mm, A key, B value) {
  if (mm != null && key != null && value != null) mm.put(key, value);
}
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: 541 / 619
Version history: 4 change(s)
Referenced in: [show references]