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

23
LINES

< > BotCompany Repo | #1031508 // test_BetterLinkedHashSet (OK!)

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (4071L) is out of date.

sclass Test_BetterLinkedHashSet {
  new LinkedHashSet a;
  new BetterLinkedHashSet b;

  int n = 1000, valueRange = 10;
  O makeEntry() { ret random(valueRange); }
  bool remove = true;
  
  run {
    repeat n {
      addToTwoCollections(a, b, makeEntry());
      if (remove) removeFromTwoCollections(a, b, makeEntry());
      print(takeFirst(10, a.iterator());
      assertEquals(asList(a.iterator()), asList(b.iterator());
      print("Size LinkedHashSet: " + n2(deepObjectSize(a))
        + ", size BetterLinkedHashSet: " + n2(deepObjectSize(b)));
    }
  }
}

svoid test_BetterLinkedHashSet() {
  new Test_BetterLinkedHashSet().run();
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031508
Snippet name: test_BetterLinkedHashSet (OK!)
Eternal ID of this version: #1031508/7
Text MD5: c1c542f75decfee8e8794f972b59365a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-03 22:26:19
Source code size: 662 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 260 / 413
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1031511 - test_ProbabilisticList (TODO: reflect new policy of replacing elements)
#1031947 - test_CompactLinkedHashSet (OK)
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)