1 | svoid test_LongTreeSetWithComparator() { |
2 | L<Long> list = repF(1000, () -> randomLong()); |
3 | TreeSet<Long> set = new((a, b) ->cmp(reverseBytesInLong(a), reverseBytesInLong(b))); |
4 | set.addAll(list); |
5 | LongTreeSet cset = new(set) { |
6 | public int compare(long a, long b) { |
7 | ret cmp(reverseBytesInLong(a), reverseBytesInLong(b)); |
8 | } |
9 | }; |
10 | |
11 | print(set); |
12 | print(cset); |
13 | assertEquals(asList(set), asList(cset)); |
14 | assertEqualsVerbose(l(set), cset.size()); |
15 | |
16 | for (Long a : shuffledIterator(list)) { |
17 | set.remove(a); |
18 | cset.remove(a); |
19 | assertEquals(asList(set), asList(cset)); |
20 | assertEqualsVerbose(l(set), cset.size()); |
21 | } |
22 | } |
Began life as a copy of #1030400
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030406 |
Snippet name: | test_LongTreeSetWithComparator (OK) |
Eternal ID of this version: | #1030406/4 |
Text MD5: | 8776625aec3701e2512ab62c7abc7a7f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-12-13 02:22:06 |
Source code size: | 662 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 206 / 244 |
Version history: | 3 change(s) |
Referenced in: | [show references] |