https://kotlinlang.org logo
#getting-started
Title
# getting-started
k

Konstantin Petrukhnov

07/30/2020, 4:39 PM
Is there some easy way to use "when" with ByteArray ? I have bunch of 2-3 byte arrays, and need to have switch. if(a.contentEquals(b)) is a valid alternative, but I was looking for something with "when(a)". (for 1.4-*)
s

Shawn

07/30/2020, 5:04 PM
Copy code
when {
  a.contentEquals(b) -> println("b")
  a.contentEquals(c) -> println("c")
  else -> ...
}
when-with-subject can only use
==
I’m pretty sure
a

Adam Juraszek

07/30/2020, 5:18 PM
Be careful if you are representing versions as bytes (
1.4.*
looks like it). We were just hit this issue: https://github.com/jasypt/jasypt/issues/33
k

Konstantin Petrukhnov

07/30/2020, 5:39 PM
thx!
2 Views