I want to get the nth element of a Seq
, something like this:
val mySeq = Seq("A", "B", "C") mySeq.get(1) // Java syntax for List. This does not work.
mySeq.apply(1)
is another way to say mySeq(1)
scala> val mySeq = Seq("A", "B", "C") mySeq: Seq[String] = List(A, B, C) scala> mySeq(0) res0: String = A scala> mySeq(1) res1: String = B
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With