sigmadelta
08/02/2017, 9:59 AMtechie01
08/02/2017, 10:15 AMdiesieben07
08/02/2017, 11:40 AMArray
constructor: Array(3) { index -> value }
, which initializes the array immediately, so you can have a non-null component type.techie01
08/02/2017, 11:43 AMdekans
08/02/2017, 2:44 PMiAmAVar?.let{ it+"XXX" } ?: "XXX"
denis.shakinov
08/02/2017, 4:15 PModay
08/03/2017, 10:02 AMhorse_badorties
08/04/2017, 6:36 AMmin()
function in Intellij?
When I do STRG-B
it loads _Collections.kt
from the generated
folder of the kotlin-stdlib-xxx-sources.jar
- which is not the actual source I guess. When I browse the kotlin\collections
folder instead I find CollectionsKt.class but this does not include the min()
function.
A "Search everywhere" doesn't help either.
What is this generated
folder about anyway? Who generates it and why? 😅oday
08/04/2017, 10:20 AMtechie01
08/04/2017, 10:46 AMkevinmost
08/04/2017, 9:59 PMvoddan
08/05/2017, 6:06 AM..
is made so to emulate the traditional for
loop. In a code for(int i = A; i < B; i++){}
nothing happens if A
is greater than B
. This is how programmers are accustomed to think about iterations. If the ..
loop worked both ways, the number of bugs would be colossal.oday
08/05/2017, 9:17 PMhttps://www.youtube.com/watch?v=AhA-Q7MOre0&list=PLtRrDEpV3zktLTZlkx0CPqyIYQ4Z9m7v0&index=5▾
danneu
08/05/2017, 11:12 PModay
08/06/2017, 11:18 AMbenleggiero
08/06/2017, 10:33 PMopen class Queue<Element>(protected var backingList: MutableList<Element> = mutableListOf()) {
fun listValue():List<Element> = List(*(backingList.toTypedArray().copyOf()))
}
Error:
Error:(44, 56) Kotlin: Cannot use 'Element' as reified type parameter. Use a class instead.
techie01
08/07/2017, 11:36 AMtechie01
08/07/2017, 2:21 PMstefano.maffullo
08/07/2017, 5:09 PMeldamsheety
08/08/2017, 1:05 PMtechie01
08/08/2017, 2:23 PMhorse_badorties
08/09/2017, 7:44 AMjava.util.EnumSet
equivalent in Kotlin? If not (how) can I use it with a Kotlin enum class
?v79
08/09/2017, 9:19 AMinfini
08/09/2017, 1:00 PMchet
08/10/2017, 6:36 AMbrokenpipe
08/10/2017, 8:14 AMmcscruff
08/10/2017, 10:46 AMmcscruff
08/10/2017, 11:05 AMtechie01
08/10/2017, 11:59 AMar-g
08/10/2017, 12:51 PMsealed class PaginationViewState<T> {
object LoadingFirstPage: PaginationViewState<T>()//doesn't work
object LoadingPage: PaginationViewState<T>()//doesn't work
data class DataLoaded<T>(val data: List<T>): PaginationViewState<T>()
data class DataLoadedFromCache<T>(val data: List<T>): PaginationViewState<T>()
data class Failure<T>(val e: Throwable): PaginationViewState<T>()
}
ar-g
08/10/2017, 12:51 PMsealed class PaginationViewState<T> {
object LoadingFirstPage: PaginationViewState<T>()//doesn't work
object LoadingPage: PaginationViewState<T>()//doesn't work
data class DataLoaded<T>(val data: List<T>): PaginationViewState<T>()
data class DataLoadedFromCache<T>(val data: List<T>): PaginationViewState<T>()
data class Failure<T>(val e: Throwable): PaginationViewState<T>()
}
marstran
08/10/2017, 12:54 PMT
for your objects.ar-g
08/10/2017, 12:55 PMmarstran
08/10/2017, 12:56 PMT
has to be an actual class/interface here: object LoadingFirstPage : PaginationViewState<T>()
PaginationViewState
with a type parameter.ar-g
08/10/2017, 12:57 PMobject LoadingFirstPage<T>: PaginationViewState<T>()
marstran
08/10/2017, 12:57 PMLoadingFirstPage
. It can't take parameters.LoadingFirstPage
should be a class then?ar-g
08/10/2017, 12:58 PMmarstran
08/10/2017, 1:09 PMT
is the type of data that the view state holds, so LoadingFirstPage
and LoadingPage
are classes, not objects.Any
is what you were looking for. I really don't think you should do that. You are losing type information that you don't have to lose.ar-g
08/10/2017, 1:21 PMPaginationViewState<AdModel> =PaginationViewState.LoadingFirstPage
. I'll stick with regular classes probablymarstran
08/10/2017, 1:46 PM