Documentation ¶
Index ¶
- type SafeMap
- func (m *SafeMap[K, V]) AppendElem(elem Tuple[K, V])
- func (m *SafeMap[K, V]) AsCollection() generics.Collection[K, V, Tuple[K, V]]
- func (m *SafeMap[K, V]) AsIterable() generics.Iterable[Tuple[K, V]]
- func (m *SafeMap[K, V]) Cap() int
- func (m *SafeMap[K, V]) Clear()
- func (m *SafeMap[K, V]) Clone() generics.Collection[K, V, Tuple[K, V]]
- func (m *SafeMap[K, V]) Delete(key K)
- func (m *SafeMap[K, V]) Factory() generics.Collection[K, V, Tuple[K, V]]
- func (m *SafeMap[K, V]) Get(key K) V
- func (m *SafeMap[K, V]) GetE(key K) (V, bool)
- func (m *SafeMap[K, V]) HasKey(key K) bool
- func (m *SafeMap[K, V]) IsEmpty() bool
- func (m *SafeMap[K, V]) Iter() *generics.Iterator[Tuple[K, V]]
- func (m *SafeMap[K, V]) IterHandler(iter *generics.Iterator[Tuple[K, V]])
- func (m *SafeMap[K, V]) Keys() []K
- func (m *SafeMap[K, V]) Len() int
- func (m *SafeMap[K, V]) Set(key K, val V)
- func (m *SafeMap[K, V]) SetElem(elem Tuple[K, V])
- func (m *SafeMap[K, V]) Values() []V
- type SafeSlice
- func (s *SafeSlice[V]) Append(item V)
- func (s *SafeSlice[V]) AppendElem(elem Tuple[int, V])
- func (s *SafeSlice[V]) AppendSafeSlice(other *SafeSlice[V])
- func (s *SafeSlice[V]) AppendSlice(slice []V)
- func (s *SafeSlice[V]) AsCollection() generics.Collection[int, V, Tuple[int, V]]
- func (s *SafeSlice[V]) AsIterable() generics.Iterable[Tuple[int, V]]
- func (s *SafeSlice[V]) Cap() int
- func (s *SafeSlice[V]) Clear()
- func (s *SafeSlice[V]) Clone() generics.Collection[int, V, Tuple[int, V]]
- func (s *SafeSlice[V]) Compare(i, j Tuple[int, V], comp func(V, V) generics.CompareResult) generics.CompareResult
- func (s *SafeSlice[V]) Delete(i int)
- func (s *SafeSlice[V]) Factory() generics.Collection[int, V, Tuple[int, V]]
- func (s *SafeSlice[V]) Get(i int) V
- func (s *SafeSlice[V]) IsEmpty() bool
- func (s *SafeSlice[V]) Iter() *generics.Iterator[Tuple[int, V]]
- func (s *SafeSlice[V]) IterHandler(iter *generics.Iterator[Tuple[int, V]])
- func (s *SafeSlice[V]) Len() int
- func (s *SafeSlice[V]) Set(i int, item V)
- func (s *SafeSlice[V]) SetElem(item Tuple[int, V])
- func (s *SafeSlice[V]) Slice(start, end int) *SafeSlice[V]
- func (s *SafeSlice[V]) Values() []V
- type Tuple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SafeMap ¶
type SafeMap[K comparable, V any] struct { // contains filtered or unexported fields }
SafeMap is a thread-safe map.
func NewSafeMap ¶
func NewSafeMap[K comparable, V any](items ...Tuple[K, V]) *SafeMap[K, V]
NewSafeMap creates a new SafeMap.
func (*SafeMap[K, V]) AppendElem ¶
AppendElem appends an element to the map.
func (*SafeMap[K, V]) AsCollection ¶
func (m *SafeMap[K, V]) AsCollection() generics.Collection[K, V, Tuple[K, V]]
func (*SafeMap[K, V]) AsIterable ¶
func (*SafeMap[K, V]) Clone ¶
func (m *SafeMap[K, V]) Clone() generics.Collection[K, V, Tuple[K, V]]
Clone returns a copy of the map.
func (*SafeMap[K, V]) Delete ¶
func (m *SafeMap[K, V]) Delete(key K)
Delete deletes a value from the map.
func (*SafeMap[K, V]) Factory ¶
func (m *SafeMap[K, V]) Factory() generics.Collection[K, V, Tuple[K, V]]
Factory returns a new instance of the map.
func (*SafeMap[K, V]) Get ¶
func (m *SafeMap[K, V]) Get(key K) V
Get gets a value from the map. Panics if the key does not exist.
func (*SafeMap[K, V]) IterHandler ¶
type SafeSlice ¶
type SafeSlice[V any] struct { // contains filtered or unexported fields }
SafeSlice is a thread-safe slice.
It doesn't check out of bounds access.
func NewSafeSlice ¶
NewSafeSlice creates a new SafeSlice.
func NewSafeSliceN ¶
NewSafeSliceN creates a new SafeSlice with size and capacity of n.
func (*SafeSlice[V]) Append ¶
func (s *SafeSlice[V]) Append(item V)
Append appends a value to the slice.
func (*SafeSlice[V]) AppendElem ¶
AppendElem appends a value to the slice.
func (*SafeSlice[V]) AppendSafeSlice ¶
AppendSafeSlice appends a SafeSlice to the slice.
func (*SafeSlice[V]) AppendSlice ¶
func (s *SafeSlice[V]) AppendSlice(slice []V)
AppendSlice appends a slice to the slice.
func (*SafeSlice[V]) AsCollection ¶
func (*SafeSlice[V]) AsIterable ¶
func (*SafeSlice[V]) Compare ¶
func (s *SafeSlice[V]) Compare(i, j Tuple[int, V], comp func(V, V) generics.CompareResult) generics.CompareResult
Compare compares two slice items.