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

17
LINES

< > BotCompany Repo | #1010615 // getMountedObjects - always returns a Map

JavaX fragment (include)

static Map getMountedObjects(O mounted) {
  if (mounted == null) null;
  Map generalMap = vm_generalMap();
  if (generalMap == null) fail("Please upgrade JavaX");
  synchronized(generalMap) {
    Map map = cast generalMap.get("mounts");
    if (map == null) {
      pcall-short {
        map = (Map) nuForeignObject(javax(), className(javax()) + '$WeakIdentityHashMap);
      }
      if (map == null) map = new WeakIdentityHashMap; // older JavaX
      generalMap.put("mounts", map);
    }
    Map m = cast map.get(mounted);
    ret m == null ? new HashMap : new HashMap(m);
  }
}

Author comment

Began life as a copy of #1010614

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1010615
Snippet name: getMountedObjects - always returns a Map
Eternal ID of this version: #1010615/5
Text MD5: 2612974c38259cdacbad764b9c05d85b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-23 05:19:58
Source code size: 596 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 414 / 434
Version history: 4 change(s)
Referenced in: [show references]