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

25
LINES

< > BotCompany Repo | #1013304 // Test CompactHashMap (OK)

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

Download Jar. Libraryless. Click here for Pure Java version (2381L/16K).

1  
!7
2  
3  
static new CompactHashMap<S> map1;
4  
static new HashMap<S> map2;
5  
6  
p {
7  
  check();
8  
  repeat 100 {
9  
    repeat 10 {
10  
      putInTwoMaps(map1, map2, aGlobalID(), aGlobalID());
11  
    }
12  
    removeFromTwoMaps(map1, map2, random(keys(map2)));
13  
    check();
14  
  }
15  
  print("OK!");
16  
}
17  
18  
svoid check {
19  
  assertEqualsVerbose(map2.size(), map1.size());
20  
  assertEquals(sorted(keys(map2)), sorted(keys(map1)));
21  
  assertEquals(sorted(values(map2)), sorted(values(map1)));
22  
  for (S key : keys(map1))
23  
    assertEquals(map2.get(key), map1.get(key));
24  
  assertNull(map1.get("unknown"));
25  
}

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: #1013304
Snippet name: Test CompactHashMap (OK)
Eternal ID of this version: #1013304/4
Text MD5: 9701863ed033f58bccba343a8feeb8b1
Transpilation MD5: 41a166a9a023223773fa852089754d2d
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-31 19:42:54
Source code size: 583 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 463 / 1053
Version history: 3 change(s)
Referenced in: [show references]