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)

static L<S> diff(Collection<S> a, Collection<S> b) {
  Set<S> set = asSet(b);
  L<S> l = new ArrayList();
  for (S s : a)
    if (!set.contains(s))
      l.add(s);
  ret l;
}

download  show line numbers  debug dex   

Travelled to 12 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, sawdedvomwva, tslmcundralx, tvejysmllsmz

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: 428 / 2052
Referenced in: [show references]

Formerly at http://tinybrain.de/1001927 & http://1001927.tinybrain.de