Libraryless. Click here for Pure Java version (5409L/30K).
svoid testMoreEfficientCopyOnWriteList() { new MoreEfficientCopyOnWriteList<Int> l; var it = l.iterator(); l.add(5); assertEquals(ll(), asList(it)); it = l.iterator(); l.add(0, 10); assertEquals(ll(5), asList(it)); assertEquals(ll(10, 5), asList(l.iterator())); // make sure this doesn't take O(n^2) time time "My list" { repeat 20000 { l.add(0); } } // ...while this does new CopyOnWriteArrayList<Int> l2; time "Their list" { repeat 20000 { l2.add(0); } } }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034558 |
Snippet name: | testMoreEfficientCopyOnWriteList |
Eternal ID of this version: | #1034558/3 |
Text MD5: | 7ec3a38e58d3b863fa35df03a1ac31ab |
Transpilation MD5: | 820890cb0d72042b833fcf355f252687 |
Author: | stefan |
Category: | javax / collections |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-02-13 18:43:32 |
Source code size: | 506 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 130 / 189 |
Version history: | 2 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |