We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.0.1
Kotlin's Iterable has methods minOrNull and maxOrNull:
Iterable
minOrNull
maxOrNull
listOf(1, 2, 3, 4, 5).minOrNull() // 1 listOf(1, 2, 3, 4, 5).maxOrNull() // 5
As a input list can be empty, they return nullable type:
emptyList<Int>().minOrNull() // null
I would be useful to have similar methods for NonEmptyList that return non-nullable values:
NonEmptyList
fun <T> NonEmptyList<T>.min(): T fun <T> NonEmptyList<T>.max(): T
Other related methods:
The text was updated successfully, but these errors were encountered:
Hey @dorians,
That'd be great! I think that method should be restricted to Comparable<T>, no?
Comparable<T>
fun <T : Comparable<T>> NonEmptyList<T>.min(): T fun <T : Comparable<T>> NonEmptyList<T>.max(): T
If you're interested we'd love the contribution!
Sorry, something went wrong.
@nomisRev yes, you're correct! I'll create PR for this one
Closed by #2622
No branches or pull requests
What version are you currently using?
1.0.1
What would you like to see?
Kotlin's
Iterable
has methodsminOrNull
andmaxOrNull
:As a input list can be empty, they return nullable type:
I would be useful to have similar methods for
NonEmptyList
that return non-nullable values:Other related methods:
The text was updated successfully, but these errors were encountered: