ziad
01/19/2018, 5:16 PMdata class MyDataClass(
val myMap: Map<Int, String> = mapOf()
)
fun addElementToMyDataClass(myInstance : MyDataClass, key : Int, value : String): MyDataClass {
val mutableCopyOfMap = myInstance.myMap.toMutableMap()
mutableCopyOfMap[key] = value
return myInstance.copy(myMap = mutableCopyOfMap)
}
cy
01/19/2018, 5:24 PMval fullTariffList = arrayOf("customer", "reseller", "vendor").flatMap { type -> testTariffList.map { it.copy(type = type) } }
katien
01/19/2018, 8:39 PMvlad
01/19/2018, 11:00 PMcedric
01/19/2018, 11:07 PMYash Jahit
01/19/2018, 11:37 PMakritrime
01/20/2018, 6:48 AMshawwn
01/20/2018, 9:16 AMelect
01/20/2018, 10:20 AMArrayList<Long>
is in ascending order? Something available in stlib?tipsy
01/20/2018, 11:16 AMfabricio
01/20/2018, 11:25 AMwhen (obj) {
null -> println("is null")
else -> println("is not null")
}
I couldn't figure out how to check for not null instead.. is that possible? like !null ->
😄Les
01/20/2018, 11:41 AMcontract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
Where does contract
come from?
What does this code do?phantom
01/20/2018, 3:41 PMDmitry Kandalov
01/20/2018, 10:50 PMalexcouch
01/21/2018, 11:37 AMfun ArrayList<ItemStack>.tick(){
var emptyStack: ItemStack
for(stack in this){
if(emptyStack == null) {
if (stack.isEmpty) {
emptyStack = stack
}
}
}
}
Ayden
01/21/2018, 12:20 PM// numberList: 1, 2, 3, 4, 5, 6
numberList.contains(1,2,6)
amanda.hinchman-dominguez
01/21/2018, 4:16 PMRuckus
01/21/2018, 4:21 PMint("whatever") ?: default
fabricio
01/21/2018, 5:44 PM.let .also .apply etc
extension methods?Olekss
01/21/2018, 7:00 PMpablisco
01/21/2018, 8:02 PMCommon
is there any blog post or guide on how it works?dave08
01/22/2018, 8:12 AMuserRepo.getUser(userId)
and it wasn't found, should it return null, throw a domain exception (NoUserFoundException) or have a sealed class with a null object? (I'm using coroutines, not Rx...)bj0
01/22/2018, 11:29 PMset(value) { baz.bar = value }
?Ruckus
01/22/2018, 11:48 PMraulraja
01/22/2018, 11:57 PMbaz
come from?aoriani
01/23/2018, 1:26 AMsealed class NetworkResource<out ResponseType, out ErrorType> {
class Loading<out ResponseType, out ErrorType> : NetworkResource<ResponseType, ErrorType>()
data class Success<out ResponseType, out ErrorType>(val response: ResponseType) : NetworkResource<ResponseType, ErrorType>()
data class Error<out ResponseType, out ErrorType>(val error: ErrorType) : NetworkResource<ResponseType, ErrorType>()
}
class NetworkObserver<ResponseType, ErrorType> : Observer<NetworkResource<ResponseType, ErrorType>> {}
When I use it from Java I'm getting incompatible types: <anonymous NetworkObserver<Object,String>> cannot be converted to Observer<NetworkResource<Object,String>>
. However if I am remove out
from NetworkResource it works for Java, but it messes type inference in Kotlin.alexanderUV
01/23/2018, 6:06 AMedwardwongtl
01/23/2018, 10:32 AMpoohbar
01/23/2018, 2:00 PMRuntime JAR files in the classpath should have the same version.
For the life of me I can't find what's pulling in the wrong version of stdlib.marcinmoskala
01/23/2018, 4:05 PMmarcinmoskala
01/23/2018, 4:05 PMRuckus
01/23/2018, 4:15 PMmarcinmoskala
01/23/2018, 4:19 PMRuckus
01/23/2018, 4:20 PM