Ramesh Ramesh - 1 year ago 129
Scala Question

how to remove every nth element from the Scala list?

Is there any methods available to remove every

n th element
from the Scala

I hope we can do this inside
method and return another list by writing a logic. But is this efficient way to do it?

Answer Source


    .filter { case (_, i) => (i + 1) % n != 0 }
    .map { case (e, _) => e }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download