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

25
LINES

< > BotCompany Repo | #1013386 // Test CompactPairKeyHashMap (OK)

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

Download Jar. Libraryless. Click here for Pure Java version (2454L/17K).

!7

static new CompactPairKeyHashMap<S, S> map1;
static new HashMap<Pair<S>, S> map2;

p {
  check();
  repeat 100 {
    repeat 10 {
      putInTwoMaps(map1, map2, pair(aGlobalID(), 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 (Pair<S> key : keys(map1))
    assertEquals(map2.get(key), map1.get(key));
  assertNull(map1.get(pair("unknown", "unknown")));
}

Author comment

Began life as a copy of #1013304

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: #1013386
Snippet name: Test CompactPairKeyHashMap (OK)
Eternal ID of this version: #1013386/5
Text MD5: a59caa255b6b5386ac5e0fdfd2ccf805
Transpilation MD5: 91de02ab8f3a6fc69975fffa5c8cd485
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-04 00:06:33
Source code size: 644 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 609 / 1286
Version history: 4 change(s)
Referenced in: