1 | static Set similarEmptySet(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 HashSet; |
6 | } |
7 | |
8 | static Set similarEmptySet(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 HashSet; |
13 | } |
Began life as a copy of #1004367
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1007943 |
| Snippet name: | similarEmptySet - make an effort to create an empty set of same type |
| Eternal ID of this version: | #1007943/7 |
| Text MD5: | a8c20c81d7088400a80caff3c90c76ae |
| 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:50:41 |
| Source code size: | 397 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 992 / 1039 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |