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


< > BotCompany Repo | #1013619 - collectionMutex - get mutex field of KeySet etc.

JavaX fragment (include)

static O collectionMutex(L l) {
  ret l;

static O collectionMutex(O o) {
  ifndef collectionMutex_simple

  if (o instanceof L) ret o;
  S c = className(o);
  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));
  if (eqOneOf(c, "java.util.TreeMap$AscendingSubMap", "java.util.TreeMap$DescendingSubMap"))
    c = className(o = get_raw(o, 'm));
  ifclass WeakHashSet
  if (o instanceof WeakHashSet)
    c = className(o = o/WeakHashSet.mutex());
  ret o;

Author comment

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/14
Text MD5: 5e9d360f4a3a8d788d9ea0e634cc0bbe
Author: stefan
Category: javax / collections
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-12 10:40:54
Source code size: 720 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 309 / 562
Version history: 13 change(s)
Referenced in: [show references]