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

15
LINES

< > BotCompany Repo | #1012477 // removeSetFromListQuickly

JavaX fragment (include)

1  
static <A> void removeSetFromListQuickly(L<A> l, Collection<A> _set) {
2  
  Set<A> set = asSet(_set);
3  
  if (l(set) < 10) {
4  
    ListIterator<A> it = l.listIterator();
5  
    while (it.hasNext())
6  
      if (set.contains(it.next()))
7  
        it.remove();
8  
  } else {
9  
    L<A> l2 = emptyListWithCapacity(l);
10  
    for (A a : l)
11  
      if (!set.contains(a))
12  
        l2.add(a);
13  
    copyList(l2, l);
14  
  }
15  
}

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: #1012477
Snippet name: removeSetFromListQuickly
Eternal ID of this version: #1012477/3
Text MD5: 5f3409333497634c5c531bc8ee51cca3
Author: stefan
Category: javax / collections
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-21 01:39:00
Source code size: 402 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 432 / 440
Version history: 2 change(s)
Referenced in: [show references]