Say I have a integer list:
val list = List(1,2,3,4,5,3,6,7)
I want to split the list by the integer 3
, so I can get a list of list:
list.splitBy(3)
// returns List(List(1,2), List(4,5), List(6,7))
Is there any built-in or neat way to do this?