Cleanup: apply "lift out..." inspection (+ some others)

This commit is contained in:
Mikhail Glukhikh
2017-06-28 14:30:52 +03:00
committed by Mikhail Glukhikh
parent 0c41ceea9d
commit 9c06739594
52 changed files with 294 additions and 311 deletions
@@ -61,13 +61,13 @@ open class BasicReplStageHistory<T>(override val lock: ReentrantReadWriteLock =
lock.write {
val idx = indexOfFirst { it.id == id }
if (idx < 0) throw java.util.NoSuchElementException("Cannot rest to inexistent line ${id.no}")
if (idx < lastIndex) {
return if (idx < lastIndex) {
val removed = asSequence().drop(idx + 1).map { it.id }.toList()
removeRange(idx + 1, size)
currentGeneration.incrementAndGet()
return removed
removed
}
else return emptyList()
else emptyList()
}
}
}