fix: fixed RemoveByIndex array list method
parent
67744fd4a1
commit
b244663a4d
|
@ -38,7 +38,7 @@ func (self *ArrayList[T]) Remove(element T) {
|
||||||
for index, value := range self.content {
|
for index, value := range self.content {
|
||||||
|
|
||||||
if any(value) == any(element) {
|
if any(value) == any(element) {
|
||||||
indexFromMove = index + 1
|
indexFromMove = index
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ func (self *ArrayList[T]) RemoveByIndex(index int) {
|
||||||
contentSize := len(self.content)
|
contentSize := len(self.content)
|
||||||
|
|
||||||
if index >= 0 {
|
if index >= 0 {
|
||||||
for i := index; i < contentSize; i++ {
|
for i := index + 1; i < contentSize; i++ {
|
||||||
self.content[i-1] = self.content[i]
|
self.content[i-1] = self.content[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue