zachtib
02/17/2019, 10:10 PMEnvelope<T>
response body adapter? The converter factory in this example uses the Java wildcard generic (*
) and I'm not sure how to adapt that to KotlinHexa
02/18/2019, 8:43 AMTom Adam
02/18/2019, 9:03 AMGarouDan
02/18/2019, 1:06 PMmethod_missing
of ruby, the __call__
in PHP, and so on.
I’ve heard about delegation in Kotlin, but I’m not so sure we can achieve the same result, for example, something like:
MyClass().unknownMethod()
// returns, for example, “You’ve called the `unknownMethod`“.
Can someone give me an small example how can we achieve that?
Thanks in advancereik.schatz
02/18/2019, 1:10 PMDynamic
but this is not what you mean probablyJeff Gulbronson
02/18/2019, 1:38 PMExtension functions should not use variables from a scope other than the scope available to them from the class they’re extending. Instead, variables should be passed in as parameters. Put another way, extension functions should be “stateless”, and not rely on where they’re defined to function. Extension functions should be able to be moved to a new file and continue to work.
Daniele Segato
02/18/2019, 4:45 PMsnowe
02/18/2019, 6:35 PMhasNext()
method, so I cannot perform whether there is an end in the while
.
public static void printEachForward(BreakIterator boundary, String source) {
int start = boundary.first();
for (int end = boundary.next();
end != BreakIterator.DONE;
start = end, end = boundary.next()) {
System.out.println(source.substring(start,end));
}
}
snowe
02/19/2019, 4:48 AMreturnFromInline { return }
inline fun returnFromInline(ret: () -> Unit) {
ret()
}
but not
returnFromInline()
inline fun returnFromInline() {
return
}
kassim
02/19/2019, 10:27 AMclass BehaviorRelayUpdateOnlyProperty<T>(relay: BehaviorRelay<T>) : BehaviorRelayProperty<T>(relay)
I wanted to prevent T from extending MutableCollection - but with your solution the new constructor shares the same JVM signature as the original
constructor(mutablePropertyRelay: BehaviorRelay<MutableCollection<*>>) : this(mutablePropertyRelay)
isn't acceptedtapchicoma
02/19/2019, 3:38 PMfun bar(): Single<List<Number>> {
return Single.just(listOf<Int>())
}
But this doesn't (type mismatch
):
fun bar(): Single<List<Number>> {
val foo = Single.just(listOf<Int>())
return foo
}
Removing Single
or changing to:
fun bar(): Single<List<Number>> {
val foo = Single.just<List<Number>>(listOf<Int>())
return foo
}
solves the issue 🤔jbnizet
02/19/2019, 3:50 PM?.
or !!
Sorry if that has been asked before. It’s been a long time I haven’t been here 🙂ziad
02/19/2019, 9:27 PMjkbbwr
02/20/2019, 2:09 AMGustav
02/20/2019, 6:28 AMdavidasync
02/20/2019, 7:12 AMfuel http client
?
I dont know why
fuel http header set the value as array of string instead of normal string
for example {Origin=[abc], Content-Type=[application/json]
instead of {Origin=abc, Content-Type=application/json
is there any method to overide it to not use array of string?Davio
02/20/2019, 7:41 AMString!
); is there an option to treat these platform types as nullable by default, meaning you have to consciously choose to deal with their possible nullability?Jay
02/20/2019, 9:11 AMinterface MyInterface: T where T : SomeType
?marstran
02/20/2019, 9:30 AMspand
02/20/2019, 1:53 PMLeoColman
02/20/2019, 2:39 PMlazy
that includes the receiver? So that I can do val Foo.bar by lazy { this.baz }
where this
is Foo
snowe
02/20/2019, 4:06 PMAndrew Gazelka
02/20/2019, 5:40 PMfun test1() {
println("1")
printId()
thread {
println("2")
printId()
throw IllegalStateException("an exception")
}.join()
println("3")
}
fun printId(){
println("Thread ID: $id")
}
val id get() = Thread.currentThread().id
and getting
1
Thread ID: 1
2
Thread ID: 11
Exception in thread "Thread-0" java.lang.IllegalStateException: an exception
at com.github.andrewgazelka.kotlintest.ThreadExceptionTestKt$test1$1.invoke(ThreadExceptionTest.kt:12)
at com.github.andrewgazelka.kotlintest.ThreadExceptionTestKt$test1$1.invoke(ThreadExceptionTest.kt)
at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)
3
why Thread-0
?Andrew Gazelka
02/20/2019, 5:41 PMMicah Church
02/21/2019, 3:42 AMchristophsturm
02/21/2019, 11:09 AMGustavo Maciel
02/21/2019, 11:10 AMIaroslav Postovalov
02/21/2019, 12:49 PMMartin Wangen
02/21/2019, 12:58 PMvar harvest : HashMap<String,Int> = HashMap()
harvest[plant.name] += amount
Hexa
02/21/2019, 2:54 PMlogger
in companion object
or just declaring it outside the class like this private val logger = LoggerFactory.getLogger()
class SomeKotlinClass{
//use logger here
}
? which one is for best practice?Hexa
02/21/2019, 2:54 PMlogger
in companion object
or just declaring it outside the class like this private val logger = LoggerFactory.getLogger()
class SomeKotlinClass{
//use logger here
}
? which one is for best practice?LeoColman
02/21/2019, 3:00 PMstreetsofboston
02/21/2019, 3:00 PM