https://kotlinlang.org logo
#announcements
Title
# announcements
o

orangy

02/17/2017, 3:17 PM
If early exit is not required, something like this:
Copy code
val a = listOf("a")
    val b = listOf("A")
    a.size == b.size && a.foldIndexed(true) { index: Int, acc: Boolean, s: String -> acc && b[index].equals(s, true)}
i

ilya.gorbunov

02/17/2017, 3:21 PM
orangy: Note that this will fail if a is longer than b
o

orangy

02/17/2017, 3:22 PM
indeed, length check should come first
also, original question had
Collection
, not
List
😕
2 Views