Involved Source Files
Package arraylist implements the array list.
Structure is not thread safe.
Reference: https://en.wikipedia.org/wiki/List_%28abstract_data_type%29
enumerable.goiterator.goserialization.go
Package-Level Type Names (total 2, both are exported)
/* sort exporteds by: | */
Iterator holding the iterator's state
indexintlist*List
Begin resets the iterator to its initial state (one-before-first)
Call Next() to fetch the first element if any.
End moves the iterator past the last element (one-past-the-end).
Call Prev() to fetch the last element if any.
First moves the iterator to the first element and returns true if there was a first element in the container.
If First() returns true, then first element's index and value can be retrieved by Index() and Value().
Modifies the state of the iterator.
Index returns the current element's index.
Does not modify the state of the iterator.
Last moves the iterator to the last element and returns true if there was a last element in the container.
If Last() returns true, then last element's index and value can be retrieved by Index() and Value().
Modifies the state of the iterator.
Next moves the iterator to the next element and returns true if there was a next element in the container.
If Next() returns true, then next element's index and value can be retrieved by Index() and Value().
If Next() was called for the first time, then it will point the iterator to the first element if it exists.
Modifies the state of the iterator.
Prev moves the iterator to the previous element and returns true if there was a previous element in the container.
If Prev() returns true, then previous element's index and value can be retrieved by Index() and Value().
Modifies the state of the iterator.
Value returns the current element's value.
Does not modify the state of the iterator.
*T : github.com/emirpasic/gods/containers.IteratorWithIndex
*T : github.com/emirpasic/gods/containers.ReverseIteratorWithIndex
func (*List).Iterator() Iterator
List holds the elements in a slice
elements[]interface{}sizeint
Add appends a value at the end of the list
All passes each element of the collection to the given function and
returns true if the function returns true for all elements.
Any passes each element of the collection to the given function and
returns true if the function ever returns true for any element.
Clear removes all elements from the list.
Contains checks 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.
Each calls the given function once for each element, passing that element's index and value.
Empty returns true if list does not contain any elements.
Find passes each element of the container to the given function and returns
the first (index,value) for which the function is true or -1,nil otherwise
if no element matches the criteria.
FromJSON populates list's elements from the input JSON representation.
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.
IndexOf returns index of provided element
Insert inserts values at specified index position shifting the value at that position (if any) and any subsequent elements to the right.
Does not do anything if position is negative or bigger than list's size
Note: position equal to list's size is valid, i.e. append.
Iterator returns a stateful iterator whose values can be fetched by an index.
Map invokes the given function once for each element and returns a
container containing the values returned by the given function.
Remove removes the element at the given index from the list.
Select returns a new container containing all elements for which the given function returns a true value.
Set the value at specified index
Does not do anything if position is negative or bigger than list's size
Note: position equal to list's size is valid, i.e. append.
Size returns number of elements within the list.
Sort sorts values (in-place) using.
String returns a string representation of container
Swap swaps the two values at the specified positions.
ToJSON outputs the JSON representation of list's elements.
Values returns all elements in the list.
Expand the array if necessary, i.e. capacity will be reached if we add n elements
(*T) resize(cap int)
Shrink the array if necessary, i.e. when size is shrinkFactor percent of current capacity
Check that the index is within bounds of the list
*T : github.com/emirpasic/gods/lists.List
*T : github.com/emirpasic/gods/containers.Container
*T : github.com/emirpasic/gods/containers.EnumerableWithIndex
*T : github.com/emirpasic/gods/containers.JSONDeserializer
*T : github.com/emirpasic/gods/containers.JSONSerializer
*T : github.com/emirpasic/gods/trees.Tree
*T : expvar.Var
*T : fmt.Stringer
*T : context.stringer
*T : runtime.stringer
func New(values ...interface{}) *List
func (*List).Map(f func(index int, value interface{}) interface{}) *List
func (*List).Select(f func(index int, value interface{}) bool) *List
Package-Level Functions (total 5, in which 1 are exported)
New instantiates a new list and adds the passed values, if any, to the list
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.