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

13
LINES

< > BotCompany Repo | #1028849 // similarEmptySetOrLinkedHashSet

JavaX fragment (include)

static Set similarEmptySetOrLinkedHashSet(Iterable m) {
  if (m instanceof TreeSet) ret new TreeSet(((TreeSet) m).comparator());
  if (m instanceof LinkedHashSet) ret new LinkedHashSet;
  
  ret new LinkedHashSet;
}

static Set similarEmptySetOrLinkedHashSet(Map m) {
  if (m instanceof TreeMap) ret new TreeSet(((TreeMap) m).comparator());
  if (m instanceof LinkedHashMap) ret new LinkedHashSet;
  
  ret new LinkedHashSet;
}

Author comment

Began life as a copy of #1007943

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028849
Snippet name: similarEmptySetOrLinkedHashSet
Eternal ID of this version: #1028849/1
Text MD5: a55e5f3b3c69bdf2c12c058d5878b9b0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-09 17:52:51
Source code size: 439 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 166 / 200
Referenced in: [show references]