Libraryless. Click here for Pure Java version (2847L/18K).
svoid test_TreeSetWithDuplicates() { TreeSetWithDuplicates<S> set = new(comparatorFromCalculatedField l()); set.addAll(ll("hello", "world", "bla", "very long")); assertEqualsOneOfVerbose(asList(set), ll("bla", "hello", "world", "very long"), ll("bla", "world", "hello", "very long")); assertEqualsVerbose(4, set.size()); // test all cases of size update set.remove("x"); // remove element not in set assertEqualsVerbose(4, set.size()); set.remove("bla"); // remove element without duplicates assertEqualsVerbose(3, set.size()); set.remove("hello"); // remove element with a remaining duplicate assertEqualsVerbose(2, set.size()); set.add("world"); // add existing element assertEqualsVerbose(2, set.size()); set.add("old"); // add new element assertEqualsVerbose(3, set.size()); set.add("new"); // add new element with existing duplicate assertEqualsVerbose(4, set.size()); test_TreeSetWithDuplicates_2(); } // test that elements with same probability are returned in // insertion order svoid test_TreeSetWithDuplicates_2() { TreeSetWithDuplicates<S> set = new(comparatorFromCalculatedField l()); LS l = ll("abc", "xyz", "def", "ppp", "aaa"); set.addAll(l); assertEqualsVerbose(l, asList(set)); }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027811 |
Snippet name: | test_TreeSetWithDuplicates |
Eternal ID of this version: | #1027811/8 |
Text MD5: | 29817da96cb73c468c4ae2616d7e11ef |
Transpilation MD5: | 6f0e4fef5b3a3bf759820e131b0e001c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-04-23 11:48:27 |
Source code size: | 1287 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 215 / 338 |
Version history: | 7 change(s) |
Referenced in: | [show references] |