Kasule Moses
06/26/2021, 1:57 PMuser
06/26/2021, 3:00 PMnilTheDev
06/27/2021, 7:12 AMcoroutines
. Unfortunately, I haven't been able to use the library kotlinx
in idea
for two hours. I have downloaded the library through Maven
.
1. Tried invalidating caches.
2. Rebuilt project.
3. Tried using it in a fresh project.
4. Even intellij
is suggesting kotlinx
in auto-completion.
5. Still it says unresolved reference
I have tried most of the solutions on the web. But nothing worked. 🙄marzelwidmer
06/27/2021, 11:01 AMdata classes
to value classes
now sonar
tell me this is not under test anymore…SomeAbsolutelyRandomStuff
06/27/2021, 11:53 AMSomeAbsolutelyRandomStuff
06/27/2021, 11:54 AMSomeAbsolutelyRandomStuff
06/27/2021, 11:56 AMKulwinder Singh
06/27/2021, 4:06 PMprevItems
and nextItems
of below data class , i have tried recursion
but it caused infinite loop because we have to find next and previous both but if i try with either previous or next then there is no infinite loop.
data class Root(val item: Int, val prevItems: List<Root>, val nextItems: List<Root>)
Suppose i have data for item
is => 1,2,3,4,5 then result i wanted is =>
Root(item: 1, prevItems: [], nextItems: [2,3,4,5])
Root(item: 2, prevItems: [1], nextItems: [3,4,5])
Root(item: 3, prevItems: [1,2], nextItems: [4,5])
Root(item: 4, prevItems: [1,2,3], nextItems: [5])
Root(item: 5, prevItems: [1,2,3,4], nextItems: [])
*for making it short i am using 1,2,3… in prevItems/nextItems instead of Root
object
what approach should i use to calculate above? also is there any kotlin collection function can help here ?hfhbd
06/28/2021, 1:07 PMDouble
usage in my project with physical classes, like kiloWatt per Hour.
before:
data class Holder(val output: Double)
now:
data class Holder(val output: Kwh)
value class Kwh(val value: Double)
Now I want to use the default math operators, plus, minus unaryPlus, unaryMinus. Is there any possibility to create default operator functions without copy paste?David Smith
06/28/2021, 4:56 PMwhen
div {
h1 { ... }
when (x) {
A -> +"text"
B -> div { ... }
}
}
The actual model that this produces reverses the order of the h1
and the other child. The order is correct if I have the same but without the with
construct. The same issue happens with if
. Am I misunderstanding something about execution order in lambdas or something?Shawn
06/28/2021, 5:17 PMnordiauwu
06/28/2021, 6:31 PMval mutex = Mutex()
runBlocking {
mutex.withLock {
...
}
}
as a workaround, but not sure if it's a good practice.Ayfri
06/29/2021, 12:34 AMRak
06/29/2021, 8:21 AMandylamax
06/29/2021, 9:33 AMclass Wrapper(val value: ULong)
When I try instantiating it from Java I get
Wrapper w = new Wrapper(5000L);
It says that the constructor is private. How do I instantiate such a class?althaf
06/29/2021, 10:14 AMfor (it in this) {
if (!isSendToRepairOrRejected) {
isSendToRepairOrRejected =
(it?.state == SubActions.SEND_FOR_REPAIR.name || it?.state == StatusName.REJECTED.name)
result.add(
WorkFlowStateData(
stateName = it?.stateName ?: "",
displayName = it?.displayName ?: "",
isCompleted = it?.status.equals(
S2BConst.STATUS_CLOSED,
true
) || it?.status.equals(
S2BConst.STATUS_IN_PROGRESS,
true
),
// TODO try to evaluate propervalue
currentState = true
)
)
} else {
break
}
}
Jolan Rensen [JetBrains]
06/29/2021, 3:17 PMFung.Yam
06/30/2021, 6:43 AMCh8n
06/30/2021, 8:31 AMCLOVIS
06/30/2021, 10:24 AMstatic
to the language. The semantic relationship between classes and objects are a beautiful way to remove complexity to the language while adding new features. To my understanding, the proposal exists for two reasons:
1. For performance reasons
2. To allow extension functions on classes that do not have a companion object
I don't think it's a good idea to introduce static
for performance reasons (the language should be about semantics, the compiler should handle performance). If it's not possible to do automatically by the compiler (because it would break backward-compatibility, or whatever) then at most it should be a JVM-specific annotation.
I don't think a new keyword is necessary for classes that do not have a companion object. I think Kotlin should allow:
fun Foo.Companion.bar() = ...
even if Foo doesn't have a Companion. Obviously the compiler will have to replace the companion by something else, but that's not really a big deal (it will be invisible in Kotlin code, and extension functions are already a bit weird from Java code, so as long as it's not something extremely strange I think it's alright)spierce7
06/30/2021, 2:40 PMuser
06/30/2021, 3:48 PMSaiedmomen
06/30/2021, 4:24 PMMAYANK SINGHAL
06/30/2021, 4:56 PMTheOnlyTails
06/30/2021, 10:34 PMclass ExampleJava {
private static int x = 10;
public static int getX() {
return x;
}
public static void setX(int num) {
x = num;
}
}
Can I do something like this in kotiln? If no, why?
println(ExampleJava.x)
ExampleJava.x = 1
Ayfri
07/01/2021, 7:30 AMMichael Grigoryan
07/02/2021, 5:02 AMAlina Dolgikh [JB]
07/02/2021, 6:14 AMWilliam Reed
07/02/2021, 1:29 PM"<cursor>"
) and it escapes properly?LlamaLad7
07/02/2021, 9:05 PMLlamaLad7
07/02/2021, 9:05 PMdiesieben07
07/02/2021, 9:09 PMLlamaLad7
07/02/2021, 9:09 PMdiesieben07
07/02/2021, 9:10 PMLlamaLad7
07/02/2021, 9:10 PMSourabh Rawat
07/02/2021, 9:15 PMA lambda compiled into invokedynamic is not serializableSo normally, you can serialize lamdas and store in database?
diesieben07
07/02/2021, 9:29 PMkotlin.jvm.internal.Lambda
(the base class for lambdas generated by the compiler on the JVM) implements java.io.Serializable
, so it can be serialized using the Java serialization mechanism - provided any captured variables are also serializable.ephemient
07/02/2021, 10:14 PMString::isEmpty
) could be considered reasonablediesieben07
07/04/2021, 8:48 AM