SortedList IndexOutBoundsException: Inconsistencia detectada. La position del artículo no es válida al eliminar el último elemento

Tengo un sinfín de desplazamiento RecyclerView. Los datos se almacenan en SortedList. Cuando el usuario se desplaza hacia abajo, el elemento que se carga aparece y desaparece cuando se cargan los siguientes 10 elementos. Recibo un error de seguimiento al eliminar LoaderItem:

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 10(offset:-1).state:11 at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5512) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5448) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5444) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595) at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3551) at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3030) at android.view.View.measure(View.java) 

Este es mi código:

Adaptador:

 val battles = SortedList(RecyclerViewItem::class.java, object : SortedListAdapterCallback<RecyclerViewItem>(this) { override fun areItemsTheSame(item1 : RecyclerViewItem?, item2 : RecyclerViewItem?) : Boolean { if (item1 is Battle && item2 is Battle && item1.id == item2.id) return true if (item1 is LoaderItem && item2 is LoaderItem) return true return false } override fun compare(o1 : RecyclerViewItem?, o2 : RecyclerViewItem?) : Int = if (o1 is Battle && o2 is Battle) { when { o1.points > o2.points -> 1 o1.points == o2.points -> 0 else -> -1 } } else -1 override fun areContentsTheSame(oldItem : RecyclerViewItem?, newItem : RecyclerViewItem?) : Boolean = if (oldItem is LoaderItem) true else (oldItem as Battle).points == (newItem as Battle).points }) fun removeLoadingItem() { (0 until battles.size()).filter { battles[it] is LoaderItem }.forEach { battles.removeItemAt(it) } } fun addDownloadedItems(battles : List<Battle>) { this.battles.addAll(battles) } 

Fragmento:

 override fun displayDownloadedBattles(battles : List<Battle>, isMore : Boolean) { pbLoader.visibility = View.GONE isLoading = false if (isMore) adapter.removeLoadingItem() adapter.addDownloadedItems(battles) }