Learning Functional Programming in Go
上QQ阅读APP看书,第一时间看更新

GroupBy example

The following code shows an example of the GroupBy() function:

// input collection:
0001, "alice", 0002
0001, "bob", 0002
0003, "cindy", 0002

GroupBy(1,3)

The output is as follows:

 0001, 0002, ["alice", "bob"]
0003, 0002, ["cindy"]