Skip to content

Commit

Permalink
Changed some types to avoid casting (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
FerrariBruno authored Mar 5, 2018
1 parent 99ca63f commit 340b1a8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract class BaseRecyclerViewAdapter : RecyclerView.Adapter<RecyclerView.ViewH
* @param item the item to be removed.
*/
@MainThread
fun removeItem(item: Any) {
fun <T> removeItem(item: T) {
items.withIndex()
.filter { it.value.item == item }
.sortedByDescending { it.index }
Expand Down Expand Up @@ -293,7 +293,7 @@ abstract class BaseRecyclerViewAdapter : RecyclerView.Adapter<RecyclerView.ViewH
* @param itemType The specified type of items to be removed.
*/
@MainThread
fun clearItems(itemType: RecycleItemType<Any, RecyclerView.ViewHolder>) {
fun clearItems(itemType: RecycleItemType<*, out RecyclerView.ViewHolder>) {
val itemsToRemove = items
.filter { it.type == itemType }
.map(Element::item)
Expand Down

0 comments on commit 340b1a8

Please sign in to comment.