You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ListOps we have a few helper methods for producing NonEmptyLists via grouping, emptiness check, etc.. We can do the same thing with Seq and NonEmptySeq.
My specific use case (which I have hit a few times by this point) is that I have a Seq[Value], and I want to group it into a Map[Key, NonEmptySeq[Value]]. At the moment there are two ways to do this:
valvalues:Seq[Value] =???deff(v: Value):Key=???// This switches to `List`s which can be inefficient. Also, this is noisy, and it has an "unsafe" call.
values.toList.groupByNel(f).mapValues(nel =>NonEmptySeq.fromSeqUnsafe(nel.toList))
// This is still noisyNonEmptySeq.fromSeq(values).map(_.groupByNem(f).toMap)(Map.empty)
This might be a subset of #4070, but that one is huge and stale. I'd rather have a separate issue for this specific pain point.
The text was updated successfully, but these errors were encountered:
In
ListOps
we have a few helper methods for producingNonEmptyList
s via grouping, emptiness check, etc.. We can do the same thing withSeq
andNonEmptySeq
.My specific use case (which I have hit a few times by this point) is that I have a
Seq[Value]
, and I want to group it into aMap[Key, NonEmptySeq[Value]]
. At the moment there are two ways to do this:This might be a subset of #4070, but that one is huge and stale. I'd rather have a separate issue for this specific pain point.
The text was updated successfully, but these errors were encountered: