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


< > BotCompany Repo | #1005270 - cloneSet - safely clone a set, try to match original type

JavaX fragment (include)

// TODO: does not detect set type (hash/tree) when it's synchronized
static <A> Set<A> cloneSet(Set<A> set) {
  if (set == null) ret new HashSet;
  synchronized(collectionMutex(set)) {
    Set<A> s = similarEmptySet(set);
    ret s;

Author comment

Began life as a copy of #1002559

download  show line numbers  debug dex   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1005270
Snippet name: cloneSet - safely clone a set, try to match original type
Eternal ID of this version: #1005270/5
Text MD5: be2717c76271d8ce5daa0a8e8fbf433f
Author: stefan
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-05 14:00:40
Source code size: 265 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 370 / 390
Version history: 4 change(s)
Referenced in: [show references]

Formerly at &