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

13
LINES

< > BotCompany Repo | #1028849 // similarEmptySetOrLinkedHashSet

JavaX fragment (include)

1  
static Set similarEmptySetOrLinkedHashSet(Iterable m) {
2  
  if (m instanceof TreeSet) ret new TreeSet(((TreeSet) m).comparator());
3  
  if (m instanceof LinkedHashSet) ret new LinkedHashSet;
4  
  
5  
  ret new LinkedHashSet;
6  
}
7  
8  
static Set similarEmptySetOrLinkedHashSet(Map m) {
9  
  if (m instanceof TreeMap) ret new TreeSet(((TreeMap) m).comparator());
10  
  if (m instanceof LinkedHashMap) ret new LinkedHashSet;
11  
  
12  
  ret new LinkedHashSet;
13  
}

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: 167 / 201
Referenced in: [show references]