standard library: added isEmpty/isNotEmpty functions for primitive arrays

This commit is contained in:
nik
2013-12-01 15:02:45 +04:00
committed by Evgeny Gerashchenko
parent b636538422
commit 45e9211943
12 changed files with 171 additions and 6 deletions
@@ -0,0 +1,29 @@
package templates
import templates.Family.*
fun arrays(): List<GenericFunction> {
val templates = iterables()
templates add f("isEmpty()") {
absentFor(Arrays)
isInline = false
doc = "Returns true if the array is empty"
returns("Boolean")
body {
"return size == 0"
}
}
templates add f("isNotEmpty()") {
absentFor(Arrays)
isInline = false
doc = "Returns true if the array is empty"
returns("Boolean")
body {
"return !isEmpty()"
}
}
return templates.sort()
}