Remove unused/redundant implementation details.
This commit is contained in:
@@ -32,8 +32,6 @@ public abstract class AbstractMutableCollection<E> protected constructor() : Abs
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isEmpty(): Boolean = size == 0
|
|
||||||
|
|
||||||
override fun addAll(elements: Collection<E>): Boolean {
|
override fun addAll(elements: Collection<E>): Boolean {
|
||||||
var modified = false
|
var modified = false
|
||||||
for (element in elements) {
|
for (element in elements) {
|
||||||
@@ -53,8 +51,7 @@ public abstract class AbstractMutableCollection<E> protected constructor() : Abs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move somehow to AbstractCollection
|
// TODO: move somehow to AbstractCollection: can't move now, because it cannot be protected on JVM, just public
|
||||||
|
|
||||||
protected open fun toArray(): Array<Any?> = copyToArrayImpl(this)
|
protected open fun toArray(): Array<Any?> = copyToArrayImpl(this)
|
||||||
|
|
||||||
open fun toJSON(): Any = this.toArray()
|
open fun toJSON(): Any = this.toArray()
|
||||||
|
|||||||
@@ -65,18 +65,12 @@ public abstract class AbstractList<out E> protected constructor() : AbstractColl
|
|||||||
private open inner class IteratorImpl : Iterator<E> {
|
private open inner class IteratorImpl : Iterator<E> {
|
||||||
/** the index of the item that will be returned on the next call to [next]`()` */
|
/** the index of the item that will be returned on the next call to [next]`()` */
|
||||||
protected var index = 0
|
protected var index = 0
|
||||||
/** the index of the item that was returned on the previous call to [next]`()`
|
|
||||||
* or [ListIterator.previous]`()` (for `ListIterator`),
|
|
||||||
* -1 if no such item exists
|
|
||||||
*/
|
|
||||||
protected var last = -1
|
|
||||||
|
|
||||||
override fun hasNext(): Boolean = index < size
|
override fun hasNext(): Boolean = index < size
|
||||||
|
|
||||||
override fun next(): E {
|
override fun next(): E {
|
||||||
if (!hasNext()) throw NoSuchElementException()
|
if (!hasNext()) throw NoSuchElementException()
|
||||||
last = index++
|
return get(index++)
|
||||||
return get(last)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,9 +90,7 @@ public abstract class AbstractList<out E> protected constructor() : AbstractColl
|
|||||||
|
|
||||||
override fun previous(): E {
|
override fun previous(): E {
|
||||||
if (!hasPrevious()) throw NoSuchElementException()
|
if (!hasPrevious()) throw NoSuchElementException()
|
||||||
|
return get(--index)
|
||||||
last = --index
|
|
||||||
return get(last)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun previousIndex(): Int = index - 1
|
override fun previousIndex(): Int = index - 1
|
||||||
|
|||||||
Reference in New Issue
Block a user