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

26
LINES

< > BotCompany Repo | #1031947 // test_CompactLinkedHashSet (OK)

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

Transpiled version (4514L) is out of date.

1  
sclass Test_CompactLinkedHashSet {
2  
  new LinkedHashSet a;
3  
  new CompactLinkedHashSet 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(n2(a) + " - " + takeFirst(10, a.iterator());
14  
      assertEquals(asList(a.iterator()), asList(b.iterator());
15  
      print("Size LinkedHashSet: " + n2(deepObjectSize(a))
16  
        + ", size CompactLinkedHashSet: " + n2(deepObjectSize(b)));
17  
    }
18  
    
19  
    b.clear();
20  
    assertEquals(0, b.size());
21  
  }
22  
}
23  
24  
svoid test_CompactLinkedHashSet() {
25  
  new Test_CompactLinkedHashSet().run();
26  
}

Author comment

Began life as a copy of #1031508

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1031947
Snippet name: test_CompactLinkedHashSet (OK)
Eternal ID of this version: #1031947/9
Text MD5: 805018932e98f6337e9847311319dfac
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-14 01:17:53
Source code size: 737 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 193 / 366
Version history: 8 change(s)
Referenced in: [show references]