Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection[T any] interface { Iterable[T] // Add adds the specified element to this collection. Add(e T) bool // AddAll adds all of the elements in the this collection. AddAll(c ...T) bool // Clear removes all of the elements from this collection. Clear() // Contains returns true if this collection contains the specified element. Contains(e T) bool // ContainsAll returns true if this collection contains all of the elements in the specified // collection. ContainsAll(c ...T) bool // Equals compares this collection with the object pass from parameter. Equals(o any) bool // IsEmpty returns true if this collection contains no elements. IsEmpty() bool // Remove removes the specified element from this collection. Remove(e T) bool // RemoveAll removes all of the elements in the specified collection from this collection. RemoveAll(c ...T) bool // RemoveIf removes all of the elements of this collection that satisfy the given predicate. RemoveIf(f func(T) bool) bool // RetainAll retains only the elements in this collection that are contained in the specified // collection. RetainAll(c ...T) bool // Size returns the number of elements in this collection. Size() int // ToSlice returns a slice containing all of the elements in this collection. ToSlice() []T }
Collection is the root interface for this collections framework hierarchy.
type Dict ¶ added in v0.3.0
type Dict[K comparable, V any] interface { Iterable2[K, V] // Clear removes all key-value pairs in this dictionary. Clear() // Clone returns a copy of this dictionary. Clone() Dict[K, V] // ContainsKey returns true if this dictionary contains a key-value pair with the specified key. ContainsKey(k K) bool // Equals compares this dictionary with the object pass from parameter. Equals(o any) bool // ForEach performs the given handler for each key-value pairs in the dictionary until all pairs // have been processed or the handler returns an error. ForEach(handler func(k K, v V) error) error // Get returns the value which associated to the specified key. Get(k K) (V, bool) // GetDefault returns the value associated with the specified key, and returns the default value // if this dictionary contains no pair with the key. GetDefault(k K, defaultVal V) V // IsEmpty returns true if this dictionary is empty. IsEmpty() bool // Keys returns a slice that contains all the keys in this dictionary. Keys() []K // Put associate the specified value with the specified key in this dictionary. Put(k K, v V) V // Remove removes the key-value pair with the specified key. Remove(k K) V // Replace replaces the value for the specified key only if it is currently in this dictionary. Replace(k K, v V) (V, bool) // Size returns the number of key-value pairs in this dictionary. Size() int // Values returns a slice that contains all the values in this dictionary. Values() []V }
Dictionary is a object that maps keys to values, and it cannot contain duplicate key.
type Iterable2 ¶ added in v0.3.0
type Iterable2[K comparable, V any] interface { // Iter returns an iterator of all key-value pairs in this collection. Iter() iter.Seq2[K, V] }
type List ¶ added in v0.3.0
type List[T any] interface { Collection[T] // AddAtIndex inserts the specified element to the specified position in this list. AddAtIndex(int, T) // Get returns the element at the specified position inn this list. Get(int) T // 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. IndexOf(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. LastIndexOf(T) int // RemoveAtIndex removes the element at the specified position in this list. RemoveAtIndex(int) T // Set replaces the element at the specified position in this list with the specified element. Set(int, T) T }
List is an ordered collection.
type Set ¶
type Set[T comparable] interface { Collection[T] // Clone returns a copy of this set. Clone() Set[T] // ForEach performs the given handler for each elements in the collection until all elements // have been processed or the handler returns an error. ForEach(func(e T) error) error }
Set is a collection interface that contains no duplicate elements.
Click to show internal directories.
Click to hide internal directories.