From b244663a4d2fc0745bd928d3c68a4055f0c81417 Mon Sep 17 00:00:00 2001 From: amorozov Date: Thu, 20 Jun 2024 17:22:00 +0300 Subject: [PATCH] fix: fixed RemoveByIndex array list method --- pkg/collections/array_list/array_list_methods.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/collections/array_list/array_list_methods.go b/pkg/collections/array_list/array_list_methods.go index c701b22..604a268 100644 --- a/pkg/collections/array_list/array_list_methods.go +++ b/pkg/collections/array_list/array_list_methods.go @@ -38,7 +38,7 @@ func (self *ArrayList[T]) Remove(element T) { for index, value := range self.content { if any(value) == any(element) { - indexFromMove = index + 1 + indexFromMove = index break } } @@ -50,7 +50,7 @@ func (self *ArrayList[T]) RemoveByIndex(index int) { contentSize := len(self.content) if index >= 0 { - for i := index; i < contentSize; i++ { + for i := index + 1; i < contentSize; i++ { self.content[i-1] = self.content[i] }