v0.0.456
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m38s

This commit is contained in:
Mike Schwörer 2024-05-18 23:38:47 +02:00
parent ce7837b9ef
commit 70106733d9
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,5 @@
package goext package goext
const GoextVersion = "0.0.455" const GoextVersion = "0.0.456"
const GoextVersionTimestamp = "2024-05-16T15:38:42+0200" const GoextVersionTimestamp = "2024-05-18T23:38:47+0200"

View File

@ -59,6 +59,18 @@ func ArrUnique[T comparable](array []T) []T {
return result return result
} }
func ArrUniqueStable[T comparable](array []T) []T {
hist := make(map[T]bool, len(array))
result := make([]T, 0, len(array))
for _, v := range array {
if _, ok := hist[v]; !ok {
hist[v] = true
result = append(result, v)
}
}
return result
}
func ArrEqualsExact[T comparable](arr1 []T, arr2 []T) bool { func ArrEqualsExact[T comparable](arr1 []T, arr2 []T) bool {
if len(arr1) != len(arr2) { if len(arr1) != len(arr2) {
return false return false