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

!7

static new CompactHashMap<S> map1;
static new HashMap<S> map2;

p {
  check();
  repeat 100 {
    repeat 10 {
      putInTwoMaps(map1, map2, aGlobalID(), aGlobalID());
    }
    removeFromTwoMaps(map1, map2, random(keys(map2)));
    check();
  }
  print("OK!");
}

svoid check {
  assertEqualsVerbose(map2.size(), map1.size());
  assertEquals(sorted(keys(map2)), sorted(keys(map1)));
  assertEquals(sorted(values(map2)), sorted(values(map1)));
  for (S key : keys(map1))
    assertEquals(map2.get(key), map1.get(key));
  assertNull(map1.get("unknown"));
}

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: 464 / 1057
Version history: 3 change(s)
Referenced in: #1013386 - Test CompactPairKeyHashMap (OK)
#1031039 - Test new, more compact CompactHashMap (OK)
#1034065 - test_CompactHashMap (OK)