-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
public fun <T: Comparable<T>> List<T>.maxes(count: Int): List<T> = buildList(count) {
val iterator = iterator()
repeat(count) {
if (!iterator.hasNext()) throw NoSuchElementException()
this.add(iterator.next())
}
while (iterator.hasNext()) {
val e = iterator.next()
var index = count - 1
this[index] = e
while (index >= 1) {
if (this[index-1] >= e) break
this[index] = this[index-1]
this[index-1] = e
index--
}
}
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Projects
Status
No status