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

15
LINES

< > BotCompany Repo | #1012477 // removeSetFromListQuickly

JavaX fragment (include)

static <A> void removeSetFromListQuickly(L<A> l, Collection<A> _set) {
  Set<A> set = asSet(_set);
  if (l(set) < 10) {
    ListIterator<A> it = l.listIterator();
    while (it.hasNext())
      if (set.contains(it.next()))
        it.remove();
  } else {
    L<A> l2 = emptyListWithCapacity(l);
    for (A a : l)
      if (!set.contains(a))
        l2.add(a);
    copyList(l2, l);
  }
}

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: 361 / 366
Version history: 2 change(s)
Referenced in: [show references]