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.

sclass Test_CompactLinkedHashSet {
  new LinkedHashSet a;
  new CompactLinkedHashSet 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(n2(a) + " - " + takeFirst(10, a.iterator());
      assertEquals(asList(a.iterator()), asList(b.iterator());
      print("Size LinkedHashSet: " + n2(deepObjectSize(a))
        + ", size CompactLinkedHashSet: " + n2(deepObjectSize(b)));
    }
    
    b.clear();
    assertEquals(0, b.size());
  }
}

svoid test_CompactLinkedHashSet() {
  new Test_CompactLinkedHashSet().run();
}

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: 120 / 264
Version history: 8 change(s)
Referenced in: [show references]