v0.0.391
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m36s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m36s
This commit is contained in:
parent
c399fa42ae
commit
4b55dbaacf
@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.390"
|
||||
const GoextVersion = "0.0.391"
|
||||
|
||||
const GoextVersionTimestamp = "2024-02-21T16:11:15+0100"
|
||||
const GoextVersionTimestamp = "2024-02-21T16:18:04+0100"
|
||||
|
@ -265,6 +265,15 @@ func ArrFirstIndex[T comparable](arr []T, needle T) int {
|
||||
return -1
|
||||
}
|
||||
|
||||
func ArrFirstIndexFunc[T any](arr []T, comp func(v T) bool) int {
|
||||
for i, v := range arr {
|
||||
if comp(v) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func ArrLastIndex[T comparable](arr []T, needle T) int {
|
||||
result := -1
|
||||
for i, v := range arr {
|
||||
@ -275,6 +284,16 @@ func ArrLastIndex[T comparable](arr []T, needle T) int {
|
||||
return result
|
||||
}
|
||||
|
||||
func ArrLastIndexFunc[T any](arr []T, comp func(v T) bool) int {
|
||||
result := -1
|
||||
for i, v := range arr {
|
||||
if comp(v) {
|
||||
result = i
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func AddToSet[T comparable](set []T, add T) []T {
|
||||
for _, v := range set {
|
||||
if v == add {
|
||||
|
Loading…
Reference in New Issue
Block a user