github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/walk/group/api.go (about)

     1  // Package group provides short aliases for functions that are used to group collection elements
     2  package group
     3  
     4  import (
     5  	"github.com/m4gshm/gollections/c"
     6  	"github.com/m4gshm/gollections/walk"
     7  )
     8  
     9  // Of - group.Of synonym of the walk.Group.
    10  func Of[T any, K comparable, W c.ForEach[T]](elements W, by func(T) K) map[K][]T {
    11  	return walk.Group(elements, by)
    12  }