expandable-recycler-view
expandable-recycler-view copied to clipboard
Question: Why does this library don't use SortedList?
Hi, this library is quite nice, but I'm wondering if there is any reason why it don't use a SortedList for the child and parent list. With a sorted list you can easily keep the items sorted and the SortedList.Callback can take care of notifying the adapter about any changes.
@malnvenshorn Best answer I can give is flexibility, List
allows each developer to make that choice. Not every model will have implementations of compare()
or want every list to be displayed according to compare()
(maybe one screen is unordered etc).
A future project for the library could be to make a subclass with what you describe, but not in the books right now.
I have to disagree with your answer. With a SortedList
you are way more flexible. You can even have an unordered list. It only depends on your implementation. And to be honest adding a few lines to implement compare()
is not that much of an overhead.
Never the less I respect your position and it is not hard for someone to change the library to use SortedList
instead of List
if needed. I did this my self and it's working fine.
@malnvenshorn Thanks for the feedback! If you run into difficulties later on with the library not allowing you to make those changes feel free to bring them up in an issue.