Groups elements inside this List
according to the Order
of the keys
produced by the given mapping function.
Groups elements inside this List
according to the Order
of the keys
produced by the given mapping function.
scala> import cats.data.NonEmptyChain scala> import scala.collection.immutable.SortedMap scala> import cats.implicits._ scala> val list = List(12, -2, 3, -5) scala> list.groupByNec(_ >= 0) res0: SortedMap[Boolean, NonEmptyChain[Int]] = Map(false -> Chain(-2, -5), true -> Chain(12, 3))