DroidKaigi / conference-app-2017

The Official Conference App for DroidKaigi 2017 Tokyo
Apache License 2.0
470 stars 140 forks source link

Why use "Iterator" for Adapter? #358

Closed eneim closed 7 years ago

eneim commented 7 years ago

Overview (Required)

I see there is an abstract "ArrayRecyclerAdapter" class which implements the Iterator interface. My wonder is why it is need?

In the case we really want the ability to iterate over the list, this line makes me feel unsafe.

Once you iterator over the list member, its content can be changed (calling Iterator#remove for example), and this changed may not be properly observed (i.e one may not call notifyChange properly due to the lack of documentation). The next question is should we allow the list to be changed by being an Iterator (rather than by normal add/addAll method)? In that case, please document out this usage by a simple comment.

eneim commented 7 years ago

@konifar Just a bit unclear, but it is not a fatal issue. The point is: why we need it to be iterator :p. Nothing special here. (A miss-use of it can be trouble, but it is rare).

konifar commented 7 years ago

Sorry, I don't remember why I implemented iterator 🙇 But as you said, it looks unnecessary now.

konifar commented 7 years ago

This is improved by @shiraji ! Thanks!