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

8
LINES

< > BotCompany Repo | #1001927 // diff - get elements of one collection that are not in another collection (works on any collection type)

JavaX fragment (include)

1  
static L<S> diff(Collection<S> a, Collection<S> b) {
2  
  Set<S> set = asSet(b);
3  
  L<S> l = new ArrayList();
4  
  for (S s : a)
5  
    if (!set.contains(s))
6  
      l.add(s);
7  
  ret l;
8  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001927
Snippet name: diff - get elements of one collection that are not in another collection (works on any collection type)
Eternal ID of this version: #1001927/1
Text MD5: 89dec199cb1e03bc887df5460f38ce05
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-29 15:28:18
Source code size: 181 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 704 / 2449
Referenced in: [show references]