Documentation
¶
Index ¶
- type Set
- func (this Set[T]) Add(item T)
- func (this Set[T]) AddMany(items ...T)
- func (this Set[T]) Contains(item T) bool
- func (this Set[T]) IsEmpty() bool
- func (this Set[T]) Length() int
- func (this Set[T]) MarshalJSON() ([]byte, error)
- func (this Set[T]) Remove(item T)
- func (this Set[T]) String() string
- func (this Set[T]) ToSlice() []T
- func (this *Set[T]) UnmarshalJSON(data []byte) error
- func (this *Set[T]) UnmarshalText(text []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T comparable] map[T]struct{}
Set uses map as set of items.
func NewSetFrom ¶
func NewSetFrom[T comparable](items ...T) Set[T]
CreateSet creates new set with given values.
func (Set[T]) MarshalJSON ¶
MarshalJSON belongs to json.Marshaler interface. It converts Golang object to JSON data.
func (Set[T]) Remove ¶
func (this Set[T]) Remove(item T)
Remove removes item from the set. It does nothing if item does not exist in the set.
func (*Set[T]) UnmarshalJSON ¶
UnmarshalJSON belongs to json.Unmarshaler interface. It parses JSON data to Golang object.
func (*Set[T]) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.