arekolek
08/11/2017, 7:56 AMArray.forEach
that passes each element as this
instead of it
?poohbar
08/11/2017, 1:42 PMadams2
08/11/2017, 3:34 PMjw
08/11/2017, 3:46 PMdragas
08/11/2017, 4:59 PM==
operator?tipsy
08/11/2017, 5:02 PMval header = ctx.header("Origin") ?: ctx.header("Referer") ?: return
origins.filter { header.startsWith(it) }.firstOrNull()?.let {
ctx.header("Access-Control-Allow-Origin", it)
}
melston
08/11/2017, 5:47 PMalex
08/12/2017, 9:16 AM<PROJECT_ROOT>/src/my/package
instead of the classically conventional <PROJECT_ROOT>/src/main/kotlin/my/package
. Basically the main/kotlin
infix disappeared. Also the resources are on the same level as the src
folder.
Is this the new project structure that Kotlin wants to adopt and become mainstream? Or are those just some odd cases?karelpeeters
08/13/2017, 7:07 AMtipsy
08/13/2017, 4:25 PMwhen (boolean) {
true -> ...
false -> ...
}
considered bad?yoavst
08/13/2017, 5:51 PMprotected X event;
public Y getEvent()
How do I call them from Kotlin (extending the class)?karelpeeters
08/13/2017, 6:03 PMn == 1
and size == 0
that means that n >= size
and so toList()
will be returned. Unless you're talking about something else, I don't think there's an issue.napperley
08/13/2017, 11:35 PMjimn
08/14/2017, 6:29 AMkarelpeeters
08/14/2017, 8:08 AM|=
is also the bitwise or operator and that would be translated as or
, and they forgot to check for the boolean case.arekolek
08/14/2017, 6:10 PMList<T>
or Iterator<T>
and does what you’d like, so I doubt there is one.
Here are two ways I could think of to implement it though:
inline fun <T, R : Comparable<R>> Iterable<T>.allMaxBy(selector: (T) -> R): List<T>? {
return map(selector).max()?.let { best -> filter { selector(it) == best } }
}
inline fun <T, R : Comparable<R>> Iterable<T>.allMaxBy(selector: (T) -> R): List<T>? {
return groupBy(selector).run { get(keys.max()) }
}
jw
08/14/2017, 6:19 PMstantronic
08/14/2017, 8:37 PMtipsy
08/14/2017, 8:50 PMvillela
08/14/2017, 8:57 PMgildor
08/15/2017, 7:57 AMkarelpeeters
08/15/2017, 9:11 AMgildor
08/15/2017, 9:29 AMsuspend fun Db.saveAsync() = async(DbPool) { db.save() }
db.saveAsync().await()
or
suspend fun Db.saveAsync() = run(DbPool) { db.save() }
db.saveAsync()
czyzby
08/15/2017, 11:03 AM1.1.3-2
(or earlier versions, for that matter). It seems that the 1.1.4
compiler does something unusual with the bytecode. Notice the warning:
Byte Buddy could not instrument all classes within the mock's type hierarchy
This problem should never occur for javac-compiled classes. This problem has been observed for classes that are:
- Compiled by older versions of scalac
- Classes that are part of the Android distribution
ulrikguenther
08/15/2017, 12:33 PMClassFormatError: Illegal field modifiers in class (different interfaces): 0x1018
all over… anyone else seeing this?ishitatsuyuki
08/15/2017, 1:02 PMshort
arithmetic.
when {
a == 0.toShort() || b == 0.toShort() || (a > 0) xor (b > 0) -> a+b
x > 0 -> if (Short.MAX_VALUE - a < b) Short.MAX_VALUE else a + b
else -> if (Short.MIN_VALUE - a < b) Short.MIN_VALUE else a + b
}.toShort()
benleggiero
08/15/2017, 1:06 PM+
, -
, *
, /
, and
, or
, etc.) result in Int
by default or Long
if one operand is a Long
.pdvrieze
08/15/2017, 3:16 PMsannysanoff
08/15/2017, 3:40 PMpoohbar
08/15/2017, 5:18 PMpoohbar
08/15/2017, 5:18 PMorangy
08/15/2017, 5:19 PMpoohbar
08/15/2017, 5:20 PMdumptruckman
08/15/2017, 5:42 PMpniederw
08/15/2017, 7:34 PM1.9
? if so, did you try 9
instead?dumptruckman
08/15/2017, 7:57 PMpniederw
08/15/2017, 8:09 PM1.9
in a build script somewheredumptruckman
08/15/2017, 8:10 PM