mirror of
https://github.com/samber/lo.git
synced 2026-04-22 15:37:14 +08:00
fa095e4b4f
* fix(doc): fix go playground demo URL * fix(doc): add more go playground demo URL
27 lines
583 B
Markdown
27 lines
583 B
Markdown
---
|
|
name: Concat
|
|
slug: concat
|
|
sourceRef: slice.go#L282
|
|
category: core
|
|
subCategory: slice
|
|
playUrl: https://go.dev/play/p/Ux2UuR2xpRK
|
|
variantHelpers:
|
|
- core#slice#concat
|
|
similarHelpers:
|
|
- it#sequence#concat
|
|
- core#slice#flatten
|
|
- core#intersection#union
|
|
position: 160
|
|
signatures:
|
|
- "func Concat[T any, Slice ~[]T](collections ...Slice) Slice"
|
|
---
|
|
|
|
Returns a new slice containing all the elements in collections. Concat conserves the order of the elements.
|
|
|
|
```go
|
|
list1 := []int{0, 1}
|
|
list2 := []int{2, 3, 4, 5}
|
|
flat := lo.Flatten(list1, list2)
|
|
// []int{0, 1, 2, 3, 4, 5}
|
|
```
|