Override indexOf implementation for sorted collections

This commit is contained in:
Gabriel Tofvesson 2021-09-27 01:11:33 +02:00
parent 299c6ea27f
commit 466716917d

View File

@ -46,6 +46,9 @@ open class SortedList<E> constructor(
open fun contains(element: E, searchForward: Boolean) = search(element, searchForward) >= 0
override fun contains(element: E) = contains(element, true)
override fun indexOf(element: E) = search(element, true)
override fun lastIndexOf(element: E) = search(element, false)
override fun containsAll(elements: Collection<E>) = containsAll(elements, true)
open fun containsAll(elements: Collection<E>, searchForward: Boolean): Boolean {
for (element in elements)