Libraryless. Click here for Pure Java version (1742L/11K).
1 | static <A> HashSet<A> cloneHashSet(Collection<A> set) { |
2 | if (set == null) ret new HashSet; |
3 | synchronized(collectionMutex(set)) { |
4 | HashSet<A> s = new(l(set)); |
5 | s.addAll(set); |
6 | ret s; |
7 | } |
8 | } |
Began life as a copy of #1005270
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020655 |
Snippet name: | cloneHashSet - safely clone a collection to HashSet |
Eternal ID of this version: | #1020655/3 |
Text MD5: | ad453ddef4ae30862e12df152c0e88d1 |
Transpilation MD5: | 3d89b789d05780ea7cb7744a48a3b30f |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-11 01:32:58 |
Source code size: | 205 bytes / 8 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 365 / 479 |
Version history: | 2 change(s) |
Referenced in: | [show references] |