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

29
LINES

< > BotCompany Repo | #1010623 // Test allWeakMaps [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (1290L/8K).

!7

p {
  setOpt(javax(), 'weakMaps_debug, true);
  L maps = allWeakMaps();
  print(l(maps) + ": " + map getClassName(maps));
  Map map = newWeakIdentityHashMap();
  print(allWeakMaps());
  Map map2 = newWeakHashMap();
  maps = allWeakMaps();
  print(l(maps) + ": " + map getClassName(maps));
  assertTrue("1", containsExactObject(maps, map));
  assertTrue("2", containsExactObject(maps, map2));
  
  print("Testing GC");
  map = null;
  map2 = null;
  int n = l(maps);
  
  while (l(maps) > n-2) {
    maps = null;
    gc();
    //sleepSeconds(1);
    maps = allWeakMaps();
    print(l(maps) + ": " + map getClassName(maps));
  }
  
  print("OK!");
}

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: #1010623
Snippet name: Test allWeakMaps [OK]
Eternal ID of this version: #1010623/17
Text MD5: ee38f1b6db15e99ed6bcb915c97370ba
Transpilation MD5: 7efcd6ed507e4d74fa2ff85488dad176
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-23 21:11:17
Source code size: 679 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 360 / 909
Version history: 16 change(s)
Referenced in: