amadeu01
01/21/2019, 7:58 PMexperimental
features in its internal's implementations? I was checking
@Suppress("NOTHING_TO_INLINE")
internal class CoroutineScheduler(
private val corePoolSize: Int,
private val maxPoolSize: Int,
private val idleWorkerKeepAliveNs: Long = IDLE_WORKER_KEEP_ALIVE_NS,
private val schedulerName: String = DEFAULT_SCHEDULER_NAME
) : Executor, Closeable {
init {
require(corePoolSize >= MIN_SUPPORTED_POOL_SIZE) {
"Core pool size $corePoolSize should be at least $MIN_SUPPORTED_POOL_SIZE"
}
require(maxPoolSize >= corePoolSize) {
"Max pool size $maxPoolSize should be greater than or equals to core pool size $corePoolSize"
}
@kotlin.internal.InlineOnly
public inline fun require(value: Boolean, lazyMessage: () -> Any): Unit {
contract {
returns() implies value
}
@ContractsDsl
@ExperimentalContracts
@InlineOnly
@SinceKotlin("1.3")
@Suppress("UNUSED_PARAMETER")
public inline fun contract(builder: ContractBuilder.() -> Unit) { }
pniederw
01/22/2019, 1:28 AMursus
01/22/2019, 6:23 AMfun foo(bar: String) {
val baseUrl = "https://${bar}com/whatever"
doFoo(baseUrl)
}
pniederw
01/22/2019, 11:02 AMcompile
for the kotlin-stdlib
dependency in its POM?katz
12/05/2019, 12:13 PMvar t = 1
var tRef: Int
get() = t
set(value) {
t = value
}
Is there better solution for tRef
?Ashutosh Panda
12/05/2019, 12:38 PMfun checkCust(accNo:Int):Int {
for (x in 0 until 10) {
return if (dataBase[x]?.accNo == accNo) {
x
} else {
-1
}
}
}
Ashutosh Panda
12/05/2019, 12:38 PMuser
12/05/2019, 2:15 PMKris Wong
12/05/2019, 3:03 PMKris Wong
12/05/2019, 3:07 PMsteenooo
12/05/2019, 4:33 PMuser
12/05/2019, 11:03 PMuser
12/05/2019, 11:20 PMuser
12/06/2019, 11:51 AMuser
12/06/2019, 2:34 PMalex
12/06/2019, 3:29 PMFlorian
12/08/2019, 11:42 AMAshutosh Panda
12/08/2019, 1:33 PMerror: unsupported [literal prefixes and suffixes]
val fishnet="Net"to"Catch fish"
Ashutosh Panda
12/08/2019, 1:33 PMJoris PZ
12/08/2019, 1:34 PMval fishnet="Net" to "Catch fish"
Joris PZ
12/08/2019, 1:34 PMto
Ashutosh Panda
12/08/2019, 1:34 PMAshutosh Panda
12/08/2019, 1:35 PMAshutosh Panda
12/08/2019, 1:46 PMfun pairGame():Pair<String,String,Int>
{
return ("Hi" to "Bye" to 5)
}
println(" ${pairGame().third}")
Ashutosh Panda
12/08/2019, 1:47 PMerror: 2 type arguments expected for class Pair<out A, out B>
Ashutosh Panda
12/08/2019, 1:47 PMfun pairGame():Pair<String,String,Int>
Tim McCormack
12/08/2019, 2:27 PMFunction
from the Java stdlib and the stream API:
import java.util.function.Function
listOf(1, 2, 3).stream().map(Function<Int, Int> { it * it })
listOf(1, 2, 3).stream().map { it * it }
I can either use the SAM object syntax or the trailing lambda syntax. Makes sense.
But then, if I make a fun that accepts a Function, the compiler will only let me use the SAM object syntax!
fun takesSAM(x: Int, f: Function<Int, Int>): Int = f.apply(x)
takesSAM(5, Function { it * it })
takesSAM(5) { it * it } // compiler error
Ashutosh Panda
12/09/2019, 6:31 AMvar allBooks= listOf<String>("Romio & Juliet","Hamlet","The tempest","macabeth")
var library= mapOf<>("Shakespeare" to allBooks[0],"Shakespeare" to allBooks[2])
val value:Boolean=allBooks.any{it.contains("Hamlet")}
println("${value}")
Ashutosh Panda
12/09/2019, 6:31 AMincomplete code
Ashutosh Panda
12/09/2019, 6:31 AM