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).

1  
!7
2  
3  
p {
4  
  setOpt(javax(), 'weakMaps_debug, true);
5  
  L maps = allWeakMaps();
6  
  print(l(maps) + ": " + map getClassName(maps));
7  
  Map map = newWeakIdentityHashMap();
8  
  print(allWeakMaps());
9  
  Map map2 = newWeakHashMap();
10  
  maps = allWeakMaps();
11  
  print(l(maps) + ": " + map getClassName(maps));
12  
  assertTrue("1", containsExactObject(maps, map));
13  
  assertTrue("2", containsExactObject(maps, map2));
14  
  
15  
  print("Testing GC");
16  
  map = null;
17  
  map2 = null;
18  
  int n = l(maps);
19  
  
20  
  while (l(maps) > n-2) {
21  
    maps = null;
22  
    gc();
23  
    //sleepSeconds(1);
24  
    maps = allWeakMaps();
25  
    print(l(maps) + ": " + map getClassName(maps));
26  
  }
27  
  
28  
  print("OK!");
29  
}

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: 524 / 1320
Version history: 16 change(s)
Referenced in: [show references]