feature: added ToSliceUnsafe method to array list

master
amorozov 2024-06-25 13:41:07 +03:00
parent 574f36e64e
commit b5430036f9
1 changed files with 4 additions and 0 deletions

View File

@ -193,6 +193,10 @@ func (self *ArrayList[T]) ToSlice() []T {
return result return result
} }
func (self *ArrayList[T]) ToSliceUnsafe() []T {
return self.content[:self.size]
}
func (self *ArrayList[T]) Find(filter func(T) bool) *optional.Optional[T] { func (self *ArrayList[T]) Find(filter func(T) bool) *optional.Optional[T] {
for index, value := range self.content { for index, value := range self.content {
if index >= self.size { if index >= self.size {