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.

1  
sclass Test_BetterLinkedHashSet {
2  
  new LinkedHashSet a;
3  
  new BetterLinkedHashSet b;
4  
5  
  int n = 1000, valueRange = 10;
6  
  O makeEntry() { ret random(valueRange); }
7  
  bool remove = true;
8  
  
9  
  run {
10  
    repeat n {
11  
      addToTwoCollections(a, b, makeEntry());
12  
      if (remove) removeFromTwoCollections(a, b, makeEntry());
13  
      print(takeFirst(10, a.iterator());
14  
      assertEquals(asList(a.iterator()), asList(b.iterator());
15  
      print("Size LinkedHashSet: " + n2(deepObjectSize(a))
16  
        + ", size BetterLinkedHashSet: " + n2(deepObjectSize(b)));
17  
    }
18  
  }
19  
}
20  
21  
svoid test_BetterLinkedHashSet() {
22  
  new Test_BetterLinkedHashSet().run();
23  
}

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: 259 / 411
Version history: 6 change(s)
Referenced in: [show references]