Skip to content

Commit 2a41c2c

Browse files
authored
Update README.md
1 parent 2d992a9 commit 2a41c2c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,15 @@ left, right := Difference[int]([]int{0, 1, 2, 3, 4, 5}, []int{0, 1, 2, 3, 4, 5})
565565
// []int{}, []int{}
566566
```
567567

568+
### Union
569+
570+
Returns all distinct elements from both collections. Result will not change the order of elements relatively.
571+
572+
```go
573+
union := lo.Union[int]([]int{0, 1, 2, 3, 4, 5}, []int{0, 2, 10})
574+
// []int{0, 1, 2, 3, 4, 5, 10}
575+
```
576+
568577
### IndexOf
569578

570579
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.

0 commit comments

Comments
 (0)