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

21
LINES

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

JavaX fragment (include)

static O collectionMutex(O 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));
  endifdef
  
  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());
  endif
    
  ret o;
}

Author comment

Began life as a copy of #1013098

download  show line numbers  debug dex   

Travelled to 7 computer(s): cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, mqqgnosmbjvj, onxytkatvevr, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1013619
Snippet name: collectionMutex - get mutex field of KeySet etc.
Eternal ID of this version: #1013619/11
Text MD5: bfe658e4cd9f7d8512952a88f377514f
Author: stefan
Category: javax / collections
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-12 11:13:29
Source code size: 590 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 97 / 217
Version history: 10 change(s)
Referenced in: [show]