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

16
LINES

< > BotCompany Repo | #1008343 // asLinkedHashSet

JavaX fragment (include)

1  
static <A> LinkedHashSet<A> asLinkedHashSet(A[] array) {
2  
  new LinkedHashSet<A> set;
3  
  for (A o : array)
4  
    if (o != null)
5  
      set.add(o);
6  
  ret set;
7  
}
8  
9  
static <A> LinkedHashSet<A> asLinkedHashSet(Collection<A> l) {
10  
  if (l instanceof LinkedHashSet) ret (LinkedHashSet) l;
11  
  new LinkedHashSet<A> set;
12  
  for (A o : l)
13  
    if (o != null)
14  
      set.add(o);
15  
  ret set;
16  
}

Author comment

Began life as a copy of #1001899

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: #1008343
Snippet name: asLinkedHashSet
Eternal ID of this version: #1008343/4
Text MD5: ed629794d2babc0d65ac4039378d73e0
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-08 01:22:25
Source code size: 384 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 589 / 606
Version history: 3 change(s)
Referenced in: [show references]