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

14
LINES

< > BotCompany Repo | #1006285 // setAddAllFirstQuick - add to beginning of list

JavaX fragment (include)

1  
static <A> bool setAddAllFirstQuick(L<A> a, Collection<A> b) {
2  
  HashSet<A> index = new HashSet(a);
3  
  new L<A> l2;
4  
  for (A x : b)
5  
    if (!index.contains(x)) {
6  
      l2.add(x);
7  
      index.add(x);
8  
    }
9  
  if (nempty(l2)) {
10  
    a.addAll(0, l2);
11  
    true;
12  
  }
13  
  false;
14  
}

Author comment

Began life as a copy of #1006284

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006285
Snippet name: setAddAllFirstQuick - add to beginning of list
Eternal ID of this version: #1006285/1
Text MD5: 88bee49b16fd733e892c2ca80f4a1f84
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-26 15:27:31
Source code size: 282 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 442 / 477
Referenced in: [show references]