Following function accepted more or less any collection and returned it filtered:
def filterEven[Repr](o: collection.IterableLike[Int, Repr]): Repr = {
o.filter { o =>
(o % 2) == 0
}
}
filterEven(List(1, 2, 3))
filterEven(Set(1, 2, 3))
How do I achieve the same with Scala 2.13? IterableLike
no longer exists there. Should I use higher kinded types somehow?