feroz_baig
10/03/2017, 6:45 PMdataList?.size+1 ?: 0
basically, if datalist isnt null, return its size+1. else, 0jlleitschuh
10/03/2017, 10:09 PMinterface SwitchMessageConverterKotlin<T> {
val supportedType: Class<T>
get() = supportedKlass.java
val supportedKlass: KClass<T> // Anyone know why the compiler complains about this `T`?
}
kirillrakhman
10/04/2017, 7:56 AMclass Foo: (key: String) -> String
gives an error "Unsupported: named parameter in function type in supertype position", but
typealias KeyFunction = (key: String) -> String
class Foo: KeyFunction
actually works.
The benefit is that when you let IDEA generate the missing members, the parameter name is set to key
instead p1
Olekss
10/04/2017, 9:11 AMs.luhmirins
10/04/2017, 11:40 AM.let {
when (it) {
// ...
}
}
myanmarking
10/04/2017, 12:33 PM{
"code": "K_PRO_BE_ERR_REGIST_INVAL_USER_AGE",
"message": "Age requirement was not respected."
}
rwachol
10/04/2017, 1:23 PMjb
10/04/2017, 4:46 PMkarelpeeters
10/05/2017, 5:39 AMtrue
or false
, not on the variable. For this reason it's a really bad idea to ever use a primitive for synchronization.lovis
10/05/2017, 8:56 AMit
inside when
? what’s the status? i can’t find it 🤔Fré Dumazy
10/05/2017, 10:24 AMCharSequence.takeIf { it.isNotBlank() }?.let { doSomethingWithThis(it) }
to execute code only if a String or CharSequence is not null or blank?jh
10/05/2017, 11:21 AMfun <T, R> Iterable<T>.zipPadded(other: Iterable<R>): List<Pair<T?,R?>>
Czar
10/05/2017, 11:26 AMfun <E : Entity, ID : Serializable> getRequired(id: ID): E
We can use it either like a) getRequired<SomeEntity,Long>(1L)
or b) val entity: SomeEntity = getRequired(1L),
It seems to me that case a) is unnecessarily verbose, I'd like to write getRequired<SomeEntity>(1L)
, because 1L
already contains information about type of the second generic parameter, so compiler can infer it, like it does in case b).jschneider
10/05/2017, 12:12 PMjschneider
10/05/2017, 12:27 PMjoao.alves
10/05/2017, 1:38 PMpablisco
10/05/2017, 7:35 PMkarelpeeters
10/06/2017, 5:56 AMFré Dumazy
10/06/2017, 8:10 AM<T: MyObject> myMethod(arg: MyWrapper<T>)
and
<T: MyObject> myMethod(arg: MyWrapper<Array<T>>)
If I try this in 2 methods with the same name, it says "The following declarations have the same JVM signature"marstran
10/06/2017, 11:45 AMval newObj = obj1.copy(name = obj2.name, ....)
.jcogilvie
10/06/2017, 4:05 PMorangy
10/06/2017, 8:42 PMayrat555
10/07/2017, 9:00 AMgeekasm
10/07/2017, 9:56 AMopen class dmap( val map : Map< String, Any > )
inline fun <T : dmap, reified TValue : dmap> T.dmap(): ReadOnlyProperty<T, TValue> {
return object : ReadOnlyProperty<T, TValue> {
override fun getValue(thisRef: T, property: KProperty<*>) = TValue( thisRef.map[property.name] ) )
}
}
christophsturm
10/08/2017, 9:07 AMShawn
10/09/2017, 3:24 PMwhen (i) {
in 0..10 -> println("matched")
else -> println("not matched")
}
println("finished")
jw
10/10/2017, 4:17 AM.map(::MyClass)
Paul Woitaschek
10/10/2017, 8:41 AMedwardwongtl
10/10/2017, 9:40 AMbuild.gradle
code up here?gildor
10/10/2017, 9:41 AMgildor
10/10/2017, 9:41 AMKarolo
10/10/2017, 9:51 AM