Ported groupByUntil function to scala-adapter

Ported the groupByUntil function to scala-adapter. This is my first time contributing, please let me know if anything is off.