Issue in comparison different list in Scala -
Issue in comparison different list in Scala -
i'm looking way compare different list types:
val = list(event1, event2, event3) val b = list(list(event1, event2, event3))
how can compare these 2 lists equality? trying nesting loop, don't think work.
you can flatten events list, so:
scala> list("e1", "e2", "e3") res0: list[string] = list(e1, e2, e3) scala> list(list("e1", "e2", "e3")) res1: list[list[string]] = list(list(e1, e2, e3)) scala> res1.flatten res2: list[string] = list(e1, e2, e3) scala> res0 == res2 res3: boolean = true
scala
Comments
Post a Comment