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   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, 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: 15 / 27
Referenced in: [show references]

Formerly at http://tinybrain.de/1028849 & http://1028849.tinybrain.de