expandable-recycler-view icon indicating copy to clipboard operation
expandable-recycler-view copied to clipboard

Question: Why does this library don't use SortedList?

Open malnvenshorn opened this issue 8 years ago • 3 comments

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 avatar May 16 '16 19:05 malnvenshorn

@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.

paul-turner avatar Jun 22 '16 18:06 paul-turner

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 avatar Jul 11 '16 09:07 malnvenshorn

@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.

paul-turner avatar Jul 12 '16 16:07 paul-turner