Kenneth
08/28/2020, 7:58 AMDaniele B
08/28/2020, 8:21 PMValentin Metz
08/29/2020, 5:31 AM488 -> 488 | 485/500
489 -> 44499 | 486/500
490 -> 70070 | 487/500
491 -> 8838 | 488/500
492 -> 3444 | 489/500
493 -> 7888 | 490/500
494 -> 494 | 491/500
496 -> 992 | 492/500
497 -> 994 | 493/500
480 -> 60000 | 477/500
460 -> 2202020 | 496/500
499 -> 499 | 497/500
498 -> 996 | 495/500
495 -> 990 | 494/500
483 -> 966 | 480/500
500 -> 500 | 498/500
290 -> 11011010 | 499/500
430 -> 11011010 | 500/500
zero_coding
08/29/2020, 7:08 AMclass GenderMapper(val id: String, val description: String)
fun GenderMapper.toGender(): Gender {
val description = this.description
return Gender.new(id) {
this.description = description
}
}
zero_coding
08/29/2020, 2:52 PMUUID!
mean?Valentin Metz
08/29/2020, 7:08 PMValentin Metz
08/30/2020, 9:05 PMAlexey Anufriev
08/31/2020, 6:34 PMif (event == null) {
return emptyArray()
}
or this
event ?: return emptyArray()
?
note: this is just the first line of the method, then comes more logicKarlo Lozovina
09/02/2020, 1:01 PMTODO("reason")
but meant just for unreachable `if`/`when` branches? (for example like Rust has unreachable!
macro do designate code paths that can't be taken)Pau
09/02/2020, 4:14 PMX is mine
. there are not mines around
Patrick Ramsey
09/02/2020, 4:49 PMEugene Freeman
09/02/2020, 7:49 PMWesley Acheson
09/03/2020, 11:54 AMval jsonHeader = HttpHeaders().let {
it.accept = listOf(MediaType.APPLICATION_JSON)
it
}
Daniele B
09/03/2020, 3:48 PMdata class
object:
val state : AppState = AppState()
where:
data class AppState (
val loginState : LoginState = LoginState(),
val showingDetail : Boolean = false,
)
data class LoginState (
val loginVar : String
)
if I want to just change a child property, it’s very simple, it just takes 1 line:
state = state.copy(showingDetail = true)
but it I want to change the property of one child, I need 3 lines:
var login = state.loginState
login = login.copy(loginVar = "my value")
state = state.copy(loginState = login)
is there a simpler syntax to achieve this?Daniele B
09/03/2020, 8:42 PMclass MyDataObj (
var a : Int
var b : Int
var c : Int
)
What is the most simple way to get an object of the same class, where each variables are the sum of variables of the elements in the list?Daniele B
09/03/2020, 8:45 PMval obj1 = MyDataObj(1,3,4)
val obj2 = MyDataObj(3,2,3)
val obj3 = MyDataObj(2,4,1)
val list = listof(obj1,obj2,obj3)
I would like to derive objTot
, which has a=6, b=9, c=8Daniele B
09/03/2020, 10:11 PMval obj1 = MyDataObj(1,3,4)
val obj2 = MyDataObj(3,2,3)
val obj3 = MyDataObj(2,4,1)
val list = listof(obj1,obj2,obj3)
using AndroidStudio/IntelliJIdea, is it possible to run a script, where I experiment a reduce function, without having to run the whole project, but just this script which references an objected defined in my project?
In other words, can I run my “playground” inside my IntellijIDEA, which references classes already defined in a projects?
I would like to run something like this
println(list.sumBy{ it.a })
Eugene Freeman
09/04/2020, 6:01 PMprivate suspend fun containsMatchIn(contentMessage: ContentMessage<*>): Boolean {
val content = contentMessage.content
return ((content is TextContent) && !hasCommand(content) && containsInText(content.text))
|| ((content is PhotoContent) && containsInImage(content))
}
into
private suspend fun containsMatchIn(contentMessage: ContentMessage<*>): Boolean {
return ((contentMessage.content is TextContent) && !hasCommand(contentMessage.content) && containsInText(val content = contentMessage.content.text))
|| ((contentMessage.content is PhotoContent) && containsInImage(contentMessage.content))
}
to get rid of the extra variable val content = contentMessage.content
?
Thanksdan
09/05/2020, 9:41 AMval res : Array<Int> = emptyArray()
res.plus(1)
println(res.size)
Wesley Acheson
09/05/2020, 12:44 PM/**
* Represents the way two [clauses][Clause] are joined.
*
* @property AND Means that this clause and the previous clause should be combined using and
* (i.e. both need to be `true`)
* @property OR Means that this clause should be combind with the previous clause using or
* (i.e. this clause needs to be true or the previous clause needs to be `true`)
*/
enum class Conjunction() {
AND,
OR
}
Or should the values be on the enums themselves?BearDev
09/07/2020, 12:19 AM> Task :compileKotlinJvm FAILED
e: java.lang.OutOfMemoryError: Java heap space
So far I have tried to adjust Build process heap size
upwards to 8000 megabytes, and have tried to provide a max memory flag of 8g to build process VM options. Neither attempt seemed to make any difference, as the compiler process seems to still max out at around 850mb when it throws an Out of memory exception.
Any help would be greatly appreciated.Emery Tanghanwaye
09/07/2020, 5:17 AMDan O'Brien
09/07/2020, 2:19 PMkey
against list B, and then by a version
. If value in list B is higher than list A, I want to replace list A with item from list B. I think compareValuesBy
might work but I’m having trouble sorting out how to implement it fully because elements might be slightly different so I’ll need to scan the list to verify if it’s not foundDaniele Segato
09/08/2020, 3:38 PM`when`<Asset>(adapter.assetGetToAsset(input))
.then {
delay(300L)
output
}
this simple thing I can't do because then
doesn't give me a coroutine context.
Do you use Mockk? Some other libraries? What are the pros and cons?
Bonus question: is there some best practice to test when you have final classes? (which are the default in kotlin).Dan O'Brien
09/09/2020, 1:00 AMMiguel Quinta
09/10/2020, 11:39 AMDan O'Brien
09/10/2020, 12:26 PMe: /home/runner/work/intellij-plugin-ld/intellij-plugin-ld/src/main/kotlin/com/github/intheclouddan/intellijpluginld/settings/LaunchDarklySettings.kt: (155, 21): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T> MutableCollection<in ???>.addAll(elements: Array<out ???>): Boolean defined in kotlin.collections
public fun <T> MutableCollection<in ???>.addAll(elements: Sequence<???>): Boolean defined in kotlin.collections
public fun <T> MutableCollection<in String!>.addAll(elements: Iterable<String!>): Boolean defined in kotlin.collections
I’ve tried assigned it to a variable and suppressing that as Unused, I’ve wrapped that section with a with
block but nothing so far is helping me with this error. Here’s a link to the line in the repo https://github.com/InTheCloudDan/intellij-plugin-ld/blob/master/src/main/kotlin/com/github/intheclouddan/intellijpluginld/settings/LaunchDarklySettings.kt#L155Skaldebane
09/10/2020, 8:19 PMSteven Wang
09/11/2020, 5:20 PMSteven Wang
09/12/2020, 5:24 PMval actuallObj: List<*> = listOf("a", "b")
how to get the contained object type (String here) ?