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

13
LINES

< > BotCompany Repo | #1010788 // lookupAllOpt2 - look up a whole list in a map, returning only found entries; also returns keys not found

JavaX fragment (include)

static <A, B> Pair<L<B>, L<A>> lookupAllOpt2(Map<A, B> map, Collection<A> l) {
  new L<B> out;
  new L<A> notfound;
  if (l != null) for (A a : l) {
    B b = map.get(a);
    if (b != null) out.add(b); else notfound.add(a);
  }
  ret pair(out, notfound);
}

static <A, B> Pair<L<B>, L<A>> lookupAllOpt2(Collection<A> l, Map<A, B> map) {
  ret lookupAllOpt2(map, l);
}

Author comment

Began life as a copy of #1010182

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: #1010788
Snippet name: lookupAllOpt2 - look up a whole list in a map, returning only found entries; also returns keys not found
Eternal ID of this version: #1010788/1
Text MD5: ff92b705454a34c4d718d2041360d82c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-03 17:33:35
Source code size: 379 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 522 / 548
Referenced in: [show references]