amadeu01
01/22/2019, 12:58 PMthana
01/22/2019, 12:59 PMbram93
01/22/2019, 2:30 PMarild
01/22/2019, 4:19 PMinterface A {
fun getInt(): Int
}
interface B {
fun getString(): String
}
fun <Union> kotlinTypeUnion(param: Union) where Union: A, Union: B {
val fromA: Int = param.getInt()
val fromB: String = param.getString()
}
kotlinTypeUnion(object: A, B {
override fun getInt() = 1
override fun getString() = "two"
})
any thoughts?robstoll
01/22/2019, 4:22 PMAshutosh Panda
12/02/2019, 1:09 PMAndrew Gazelka
12/02/2019, 5:36 PMFile
but not for Path
?ursus
12/03/2019, 5:01 AMursus
12/03/2019, 5:02 AMprivate var items = emptyList<ChannelHead>()
private val itemGetter: (Int) -> ChannelHead = items::get
...
fun setData(items: List<ChannelHead>) {
this.items = items
}
later when itemGetter called this crashes on java.lang.IndexOutOfBoundsException: Empty list doesn't contain element at index 1.
ursus
12/03/2019, 5:02 AMprivate val itemGetter: (Int) -> ChannelHead = { items[it] }
it works, huhursus
12/03/2019, 5:03 AMursus
12/03/2019, 6:52 AMursus
12/03/2019, 6:55 AMarekolek
12/03/2019, 11:24 AMdiff({//do some},{// do some})
though 😛Rick
12/03/2019, 11:30 AMAshutosh Panda
12/04/2019, 10:12 AMclass customer(val name:String?=null,val accNo:Int?=null) {
val currBal:Double=0.0
var phNo:Int?=null
var gender:String?=null
init {
println("The customer name is ${name}"+"Current balance is ${currBal}"+"Gender is ${gender} and phone number is ${phNo}")
}
}
Ashutosh Panda
12/04/2019, 10:12 AMvar i:Int=0
var dataBase=arrayOfNulls<customer>(10)
fun main()
{
createCustomer()
}
fun createCustomer()
{
dataBase[i]=customer("Ashutosh",121)
println("${dataBase[i].name}")
Pacane
12/04/2019, 3:12 PMSylvain Patenaude
12/04/2019, 4:54 PMbyte[] BitConverter.GetBytes(Int32)
will preserve the computer architecture byte order (big-endian or little-endian).
Is there some equivalent (keeping the proper byte order) to this method in Kotlin?
NOTE: It is to be used in a Kotlin multiplatform context.
Thread in #multiplatformsonofblip
12/04/2019, 6:36 PMJoshy Josh
12/04/2019, 7:17 PMAdam Spofford
12/04/2019, 10:01 PMAdam Spofford
12/04/2019, 10:01 PMAdam Spofford
12/04/2019, 10:02 PMAdam Spofford
12/04/2019, 10:05 PMwriteObject
method for writing to the stream wtihout providing a SequenceScope
receiver to everythingMaurice Jouvet
12/05/2019, 8:41 AMjimn
12/05/2019, 11:51 AMval right = pivot.get(*(1 until pivotColumns.size).toList().toIntArray()).invoke {
(it.let { deepTrim(it) as Array<Any?> }.map { (it as? Float) ?: 0f }.sum())
}
i have found overloading index with ranges has some really silly outcomes as well. like the narrow sliver of syntax I am permitted seems to vanish when there becomes megamorphic overloads