list

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayList

type ArrayList[T any] []T

func NewArrayList

func NewArrayList[T any]() *ArrayList[T]

NewArrayList creates and returns a new empty list.

func (*ArrayList[T]) Add

func (l *ArrayList[T]) Add(e T) bool

Add adds the specified element to the end of this list.

func (*ArrayList[T]) AddAll

func (l *ArrayList[T]) AddAll(c ...T) bool

AddAll adds all of the elements to the end of this list.

func (*ArrayList[T]) AddAtIndex

func (l *ArrayList[T]) AddAtIndex(i int, e T)

AddAtIndex inserts the specified element at the specified position in this list.

func (*ArrayList[T]) Clear

func (l *ArrayList[T]) Clear()

Clear removes all of the elements from this list.

func (*ArrayList[T]) Clone

func (l *ArrayList[T]) Clone() collection.List[T]

Clone returns a copy of this list.

func (*ArrayList[T]) Contains

func (l *ArrayList[T]) Contains(e T) bool

Contains returns true if this list contains the specified element.

func (*ArrayList[T]) ContainsAll

func (l *ArrayList[T]) ContainsAll(c ...T) bool

ContainsAll returns true if this list contains all of the elements.

func (*ArrayList[T]) Equals

func (l *ArrayList[T]) Equals(o any) bool

Equals returns true if this list is equal to the specified list.

func (*ArrayList[T]) Get

func (l *ArrayList[T]) Get(i int) T

Get returns the element at the specified position in this list.

func (*ArrayList[T]) IndexOf

func (l *ArrayList[T]) IndexOf(e T) int

IndexOf returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

func (*ArrayList[T]) IsEmpty

func (l *ArrayList[T]) IsEmpty() bool

IsEmpty returns true if this list contains no elements.

func (*ArrayList[T]) Iter

func (l *ArrayList[T]) Iter() iter.Seq[T]

Iter returns an iterator over the elements in this list in proper sequence.

func (*ArrayList[T]) LastIndexOf

func (l *ArrayList[T]) LastIndexOf(e T) int

LastIndexOf returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

func (*ArrayList[T]) Remove

func (l *ArrayList[T]) Remove(e T) bool

Remove removes all occurrences of the specified element from this list, if it is present. Returns true if this list contained the specified element.

func (*ArrayList[T]) RemoveAll

func (l *ArrayList[T]) RemoveAll(c ...T) bool

RemoveAll removes all occurrences of the specified elements from this list, if they are present. Returns true if this list contained any of the specified elements.

func (*ArrayList[T]) RemoveAtIndex

func (l *ArrayList[T]) RemoveAtIndex(i int) T

RemoveAtIndex removes the element at the specified position in this list. Returns the element that was removed from the list.

func (*ArrayList[T]) RemoveIf

func (l *ArrayList[T]) RemoveIf(f func(T) bool) bool

RemoveIf removes all of the elements of this list that satisfy the given predicate. Returns true if any elements were removed.

func (*ArrayList[T]) RetainAll

func (l *ArrayList[T]) RetainAll(c ...T) bool

RetainAll retains only the elements in this list that are contained in the specified elements. In other words, removes from this list all of its elements that are not contained in the specified elements. Returns true if this list changed as a result of the call.

func (*ArrayList[T]) Set

func (l *ArrayList[T]) Set(i int, e T) T

Set replaces the element at the specified position in this list with the specified element. Returns the element previously at the specified position. If the index is equal to the size of this list, the element is appended to the end of this list and a zero value is returned.

func (*ArrayList[T]) Size

func (l *ArrayList[T]) Size() int

Size returns the number of elements in this list.

func (*ArrayList[T]) ToSlice

func (l *ArrayList[T]) ToSlice() []T

ToSlice returns a slice containing all of the elements in this list in proper sequence.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL