From 2a41c2cd7730661dbaa6ad9f5fb17da8db92e85f Mon Sep 17 00:00:00 2001 From: Samuel Berthe Date: Thu, 10 Mar 2022 08:04:05 +0100 Subject: [PATCH] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index dd3cc2d9..1d1a2668 100644 --- a/README.md +++ b/README.md @@ -565,6 +565,15 @@ left, right := Difference[int]([]int{0, 1, 2, 3, 4, 5}, []int{0, 1, 2, 3, 4, 5}) // []int{}, []int{} ``` +### Union + +Returns all distinct elements from both collections. Result will not change the order of elements relatively. + +```go +union := lo.Union[int]([]int{0, 1, 2, 3, 4, 5}, []int{0, 2, 10}) +// []int{0, 1, 2, 3, 4, 5, 10} +``` + ### IndexOf Returns the index at which the first occurrence of a value is found in an array or return -1 if the value cannot be found.