As a newcomer to the Kotlin coder, I wonder if there are any good practices or even language constructs for declaring preconditions in functions.
In Java, I used the Guava Preconditions validation utilities:
https://github.com/google/guava/wiki/PreconditionsExplained
After some further research, I came across the require function:
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/require.html
Is this what is commonly used to test prerequisites for functions?
. Preconditions.kt. require requireNotNull, check checkNotNull.
Kotlin, Objects # requireNonNull jdk .
, . .
assert() require() stdlib.
assert()
require()
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/assert.html https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/require.html
, "require" , , - , , "require" , "require" . , () "" .
( "", , kotlin, , - , , - , , , " - /. , .)
Source: https://habr.com/ru/post/1681563/More articles:Ios strings - main.storyboard not found in base localization - iosCan plv8 extend JavaScript to third-party libraries? - postgresqlFormatting problems with Heatmap.2 function in gplots library - fields and axis - rAngular 4 loading events using @HostListener - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1681562/removing-edges-to-eliminate-all-but-one-cycle-free-path-between-two-nodes&usg=ALkJrhh5ntIvcNoa7rX2bQpS9AEPLSBZUgHow to correctly implement didFailProvisionalNavigation using WKWebView? - iosKotlin Java Private Field Access Extension Feature - kotlinAzure Feature Queue trigger lags behind - azureFinding the position of the first occurrence of a value in std :: integer_sequence - c ++Как исправить Jest "Не найдено тестов" на окнах 10? - jestjsAll Articles