collections: companion code for the How to Sort a HashMap by Value (and Key) post

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KqJyCidz3ZgRyHABv2GVJh
This commit is contained in:
Claude
2026-09-30 19:10:13 +00:00
parent 366579f478
commit 381f119308
22 changed files with 509 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
ascending : {bob=70, carol=85, alice=90, erin=95}
reversed() : {erin=95, alice=90, carol=85, bob=70}
firstEntry() : bob=70
lastEntry() : erin=95
top2 (by pos) : [erin=95, alice=90]
after put via view (no longer sorted): {bob=70, carol=85, alice=90, erin=95, zed=99}
putLast/putFirst : {carol=85, alice=90, erin=95, zed=99, bob=70}
TreeMap first : alice=90 reversed: {zed=99, erin=95, carol=85, bob=70, alice=90}
pollFirstEntry: carol=85 -> {alice=90, erin=95, zed=99, bob=70}