Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Sorted list data struct with insert/get(index) in lg time (github.com/nextopio)
18 points by mulchpower on Feb 15, 2015 | hide | past | favorite | 2 comments


What is the advantage compared to TreeSet from standard library?


SortedList lets you get(i) to get the ith item in sorted order, and that's as fast as a TreeSet contains. It also splays so near each other faster the second+ time called. I use this for UIs that do scrolling/paging, and for models/view s that need to query ordered data. For example I have messages coming in real time, put them in a sorted list by importance, and display with a simple list view. Each time a new message comes in, it's lg time to update the view regardless of how long it is.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: