Documentation ¶
Index ¶
- Constants
- type List
- func (list *List) Add(elements ...interface{})
- func (list *List) Clear()
- func (list *List) Contains(elements ...interface{}) bool
- func (list *List) Empty() bool
- func (list *List) Get(index int) (interface{}, bool)
- func (list *List) Remove(index int)
- func (list *List) Size() int
- func (list *List) Sort(comparator utils.Comparator)
- func (list *List) String() string
- func (list *List) Swap(i, j int)
- func (list *List) Values() []interface{}
Constants ¶
View Source
const ( GROWTH_FACTOR = float32(2.0) // growth by 100% SHRINK_FACTOR = float32(0.25) // shrink when size is 25% of capacity (0 means never shrink) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
func (*List) Add ¶
func (list *List) Add(elements ...interface{})
Appends a value at the end of the list
func (*List) Contains ¶
Check if elements (one or more) are present in the set. All elements have to be present in the set for the method to return true. Performance time complexity of n^2. Returns true if no arguments are passed at all, i.e. set is always super-set of empty set.
func (*List) Get ¶
Returns the element at index. Second return parameter is true if index is within bounds of the array and array is not empty, otherwise false.
func (*List) Sort ¶
func (list *List) Sort(comparator utils.Comparator)
Sorts values (in-place) using timsort.
Click to show internal directories.
Click to hide internal directories.