michaelzinn
08/21/2017, 11:55 AMpniederw
08/21/2017, 12:17 PMclass Foo {
companion object
}
fun Foo.Companion.bar() { println("bar") }
fun main(args: Array<String>) {
Foo.bar()
}
only works for Kotlin classes thoughlovis
08/21/2017, 12:23 PMmichaelzinn
08/21/2017, 1:02 PMjkbbwr
08/21/2017, 1:13 PMmichaelzinn
08/21/2017, 1:14 PMuser
08/21/2017, 1:33 PM@JvmName
doesn't exist outside the JVM Kotlin compileruser
08/21/2017, 1:42 PMval Collection<String>.palindromes: List<String>
get() = map { it.split(" ") } .filter { it.isPalindrome()) }
var MutableCollection<String>.palindromes: List<String>
@JvmName("prop2")
get() = map { it.split(" ") } .filter { it.isPalindrome()) }
set(list: List<String>) = addAll(list.palindromes)
rrader
08/21/2017, 1:49 PMuser
08/21/2017, 1:50 PMPaul Woitaschek
08/21/2017, 2:24 PMuser
08/21/2017, 2:25 PMarrayOf(1, 2, 5).forEach(::println)
? 😉user
08/21/2017, 2:27 PMarrayOf
and listOf
was what I was hoping to avoid 😛jkbbwr
08/21/2017, 2:28 PMuser
08/21/2017, 2:29 PMuser
08/21/2017, 2:33 PMintArrayOf(1, 2, 3)
which avoids the boxinguser
08/21/2017, 2:34 PMuser
08/21/2017, 2:36 PMjkbbwr
08/21/2017, 2:37 PMjkbbwr
08/21/2017, 2:37 PMuser
08/21/2017, 2:38 PMarekolek
08/21/2017, 3:55 PMuser
08/21/2017, 5:02 PMcompile 'junit:junit:4.12'
should use testCompile
instead of compile
. That way, junit is not added to the apk. (This will not fix your problem, just reduce apk size).karelpeeters
08/21/2017, 9:32 PMSequence
interface exist at all? The only thing it does is return an iterator, so why this step of indirection? It would also be possible to just pass the Iterator
itself.jw
08/21/2017, 9:41 PMkarelpeeters
08/21/2017, 9:49 PMIterable
be lazy?diesieben07
08/21/2017, 9:54 PMfilter
on an Iterable
eagerly filters the elements and returns a (filtered) List
. filter
on Sequence
returns a new Sequence
which lazily filters the elements. Same for map
, flatMap
, etc.karelpeeters
08/21/2017, 9:56 PMkarelpeeters
08/21/2017, 9:57 PMCollection.filter
eagerly filter indeed.