Libraryless. Click here for Pure Java version (62L/1K).
// TODO: JDK 17!! ?? No! Yes? Yes!!
static O collectionMutex(L l) {
ret l;
}
static O collectionMutex(O o) {
ifndef collectionMutex_simple
if (o instanceof L) ret o;
// TODO: actually use our own maps so we can get the mutex properly
S c = className(o);
ifdef collectionMutex_legacy
if (eq(c, "java.util.TreeMap$KeySet"))
c = className(o = getOpt(o, 'm));
else if (eq(c, "java.util.HashMap$KeySet"))
c = className(o = get_raw(o, 'this$0));
ifdef collectionMutex_debug
print("Class name: " + className(o));
endifdef
if (eqOneOf(c, "java.util.TreeMap$AscendingSubMap", "java.util.TreeMap$DescendingSubMap"))
c = className(o = get_raw(o, 'm));
endifdef
ifclass WeakHashSet
if (o instanceof WeakHashSet)
/*c = className*/(o = o/WeakHashSet.mutex());
endif
endifndef
ret o;
}Began life as a copy of #1013098
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jozkyjcghlvl, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1013619 |
| Snippet name: | collectionMutex - get mutex field of KeySet etc. |
| Eternal ID of this version: | #1013619/16 |
| Text MD5: | bce2abdcf5382c10f8a2732841b84e90 |
| Transpilation MD5: | 400418b39755edf36b469586a3be6f90 |
| Author: | stefan |
| Category: | javax / collections |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-01-20 01:32:21 |
| Source code size: | 882 bytes / 36 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1257 / 1758 |
| Version history: | 15 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |