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

11
LINES

< > BotCompany Repo | #1006284 // setAddAllQuick - make index first

JavaX fragment (include)

1  
static <A> bool setAddAllQuick(Collection<A> a, Collection<A> b) {
2  
  Set<A> index = a instanceof Set ? (Set) a : new HashSet(a);
3  
  bool change = false;
4  
  for (A x : unnull(b))
5  
    if (!index.contains(x)) {
6  
      a.add(x);
7  
      if (index != a) index.add(x);
8  
      change = true;
9  
    }
10  
  ret change;
11  
}

Author comment

Began life as a copy of #1003016

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: #1006284
Snippet name: setAddAllQuick - make index first
Eternal ID of this version: #1006284/3
Text MD5: 6611043917c58660616fab78eed223d2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-03 19:29:31
Source code size: 310 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 476 / 462
Version history: 2 change(s)
Referenced in: [show references]