hashset

package
v1.2.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Example
l := NewInt()

for _, v := range []int{10, 12, 15} {
	l.Add(v)
}

if l.Contains(10) {
	fmt.Println("hashset contains 10")
}

l.Range(func(value int) bool {
	fmt.Println("hashset range found ", value)
	return true
})

l.Remove(15)
fmt.Printf("hashset contains %d items\r\n", l.Len())
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteSet added in v1.2.6

type ByteSet map[byte]struct{}

func NewByte added in v1.2.6

func NewByte() ByteSet

NewByte returns an empty byte set

func NewByteWithSize added in v1.2.6

func NewByteWithSize(size int) ByteSet

NewByteWithSize returns an empty byte set initialized with specific size

func (ByteSet) Add added in v1.2.6

func (s ByteSet) Add(value byte) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (ByteSet) Contains added in v1.2.6

func (s ByteSet) Contains(value byte) bool

Contains returns true if this set contains the specified element

func (ByteSet) Len added in v1.2.6

func (s ByteSet) Len() int

func (ByteSet) Range added in v1.2.6

func (s ByteSet) Range(f func(value byte) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (ByteSet) Remove added in v1.2.6

func (s ByteSet) Remove(value byte) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Complex128Set added in v1.2.6

type Complex128Set map[complex128]struct{}

func NewComplex128 added in v1.2.6

func NewComplex128() Complex128Set

NewComplex128 returns an empty complex128 set

func NewComplex128WithSize added in v1.2.6

func NewComplex128WithSize(size int) Complex128Set

NewComplex128WithSize returns an empty complex128 set initialized with specific size

func (Complex128Set) Add added in v1.2.6

func (s Complex128Set) Add(value complex128) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Complex128Set) Contains added in v1.2.6

func (s Complex128Set) Contains(value complex128) bool

Contains returns true if this set contains the specified element

func (Complex128Set) Len added in v1.2.6

func (s Complex128Set) Len() int

func (Complex128Set) Range added in v1.2.6

func (s Complex128Set) Range(f func(value complex128) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Complex128Set) Remove added in v1.2.6

func (s Complex128Set) Remove(value complex128) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Complex64Set added in v1.2.6

type Complex64Set map[complex64]struct{}

func NewComplex64 added in v1.2.6

func NewComplex64() Complex64Set

NewComplex64 returns an empty complex64 set

func NewComplex64WithSize added in v1.2.6

func NewComplex64WithSize(size int) Complex64Set

NewComplex64WithSize returns an empty complex64 set initialized with specific size

func (Complex64Set) Add added in v1.2.6

func (s Complex64Set) Add(value complex64) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Complex64Set) Contains added in v1.2.6

func (s Complex64Set) Contains(value complex64) bool

Contains returns true if this set contains the specified element

func (Complex64Set) Len added in v1.2.6

func (s Complex64Set) Len() int

func (Complex64Set) Range added in v1.2.6

func (s Complex64Set) Range(f func(value complex64) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Complex64Set) Remove added in v1.2.6

func (s Complex64Set) Remove(value complex64) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Float32Set

type Float32Set map[float32]struct{}

func NewFloat32

func NewFloat32() Float32Set

NewFloat32 returns an empty float32 set

func NewFloat32WithSize

func NewFloat32WithSize(size int) Float32Set

NewFloat32WithSize returns an empty float32 set initialized with specific size

func (Float32Set) Add

func (s Float32Set) Add(value float32) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Float32Set) Contains

func (s Float32Set) Contains(value float32) bool

Contains returns true if this set contains the specified element

func (Float32Set) Len

func (s Float32Set) Len() int

func (Float32Set) Range

func (s Float32Set) Range(f func(value float32) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Float32Set) Remove

func (s Float32Set) Remove(value float32) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Float64Set

type Float64Set map[float64]struct{}

func NewFloat64

func NewFloat64() Float64Set

NewFloat64 returns an empty float64 set

func NewFloat64WithSize

func NewFloat64WithSize(size int) Float64Set

NewFloat64WithSize returns an empty float64 set initialized with specific size

func (Float64Set) Add

func (s Float64Set) Add(value float64) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Float64Set) Contains

func (s Float64Set) Contains(value float64) bool

Contains returns true if this set contains the specified element

func (Float64Set) Len

func (s Float64Set) Len() int

func (Float64Set) Range

func (s Float64Set) Range(f func(value float64) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Float64Set) Remove

func (s Float64Set) Remove(value float64) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Int16Set

type Int16Set map[int16]struct{}

func NewInt16

func NewInt16() Int16Set

NewInt16 returns an empty int16 set

func NewInt16WithSize

func NewInt16WithSize(size int) Int16Set

NewInt16WithSize returns an empty int16 set initialized with specific size

func (Int16Set) Add

func (s Int16Set) Add(value int16) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Int16Set) Contains

func (s Int16Set) Contains(value int16) bool

Contains returns true if this set contains the specified element

func (Int16Set) Len

func (s Int16Set) Len() int

func (Int16Set) Range

func (s Int16Set) Range(f func(value int16) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Int16Set) Remove

func (s Int16Set) Remove(value int16) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Int32Set

type Int32Set map[int32]struct{}

func NewInt32

func NewInt32() Int32Set

NewInt32 returns an empty int32 set

func NewInt32WithSize

func NewInt32WithSize(size int) Int32Set

NewInt32WithSize returns an empty int32 set initialized with specific size

func (Int32Set) Add

func (s Int32Set) Add(value int32) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Int32Set) Contains

func (s Int32Set) Contains(value int32) bool

Contains returns true if this set contains the specified element

func (Int32Set) Len

func (s Int32Set) Len() int

func (Int32Set) Range

func (s Int32Set) Range(f func(value int32) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Int32Set) Remove

func (s Int32Set) Remove(value int32) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Int64Set

type Int64Set map[int64]struct{}

func NewInt64

func NewInt64() Int64Set

NewInt64 returns an empty int64 set

func NewInt64WithSize

func NewInt64WithSize(size int) Int64Set

NewInt64WithSize returns an empty int64 set initialized with specific size

func (Int64Set) Add

func (s Int64Set) Add(value int64) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Int64Set) Contains

func (s Int64Set) Contains(value int64) bool

Contains returns true if this set contains the specified element

func (Int64Set) Len

func (s Int64Set) Len() int

Len returns the number of elements of this set

func (Int64Set) Range

func (s Int64Set) Range(f func(value int64) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Int64Set) Remove

func (s Int64Set) Remove(value int64) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Int8Set added in v1.2.6

type Int8Set map[int8]struct{}

func NewInt8 added in v1.2.6

func NewInt8() Int8Set

NewInt8 returns an empty int8 set

func NewInt8WithSize added in v1.2.6

func NewInt8WithSize(size int) Int8Set

NewInt8WithSize returns an empty int8 set initialized with specific size

func (Int8Set) Add added in v1.2.6

func (s Int8Set) Add(value int8) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Int8Set) Contains added in v1.2.6

func (s Int8Set) Contains(value int8) bool

Contains returns true if this set contains the specified element

func (Int8Set) Len added in v1.2.6

func (s Int8Set) Len() int

func (Int8Set) Range added in v1.2.6

func (s Int8Set) Range(f func(value int8) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Int8Set) Remove added in v1.2.6

func (s Int8Set) Remove(value int8) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type IntSet

type IntSet map[int]struct{}

func NewInt

func NewInt() IntSet

NewInt returns an empty int set

func NewIntWithSize

func NewIntWithSize(size int) IntSet

NewIntWithSize returns an empty int set initialized with specific size

func (IntSet) Add

func (s IntSet) Add(value int) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (IntSet) Contains

func (s IntSet) Contains(value int) bool

Contains returns true if this set contains the specified element

func (IntSet) Len

func (s IntSet) Len() int

func (IntSet) Range

func (s IntSet) Range(f func(value int) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (IntSet) Remove

func (s IntSet) Remove(value int) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type RuneSet added in v1.2.6

type RuneSet map[rune]struct{}

func NewRune added in v1.2.6

func NewRune() RuneSet

NewRune returns an empty rune set

func NewRuneWithSize added in v1.2.6

func NewRuneWithSize(size int) RuneSet

NewRuneWithSize returns an empty rune set initialized with specific size

func (RuneSet) Add added in v1.2.6

func (s RuneSet) Add(value rune) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (RuneSet) Contains added in v1.2.6

func (s RuneSet) Contains(value rune) bool

Contains returns true if this set contains the specified element

func (RuneSet) Len added in v1.2.6

func (s RuneSet) Len() int

func (RuneSet) Range added in v1.2.6

func (s RuneSet) Range(f func(value rune) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (RuneSet) Remove added in v1.2.6

func (s RuneSet) Remove(value rune) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type StringSet added in v1.2.6

type StringSet map[string]struct{}

func NewString added in v1.2.6

func NewString() StringSet

NewString returns an empty string set

func NewStringWithSize added in v1.2.6

func NewStringWithSize(size int) StringSet

NewStringWithSize returns an empty string set initialized with specific size

func (StringSet) Add added in v1.2.6

func (s StringSet) Add(value string) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (StringSet) Contains added in v1.2.6

func (s StringSet) Contains(value string) bool

Contains returns true if this set contains the specified element

func (StringSet) Len added in v1.2.6

func (s StringSet) Len() int

func (StringSet) Range added in v1.2.6

func (s StringSet) Range(f func(value string) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (StringSet) Remove added in v1.2.6

func (s StringSet) Remove(value string) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Uint16Set

type Uint16Set map[uint16]struct{}

func NewUint16

func NewUint16() Uint16Set

NewUint16 returns an empty uint16 set

func NewUint16WithSize

func NewUint16WithSize(size int) Uint16Set

NewUint16WithSize returns an empty uint16 set initialized with specific size

func (Uint16Set) Add

func (s Uint16Set) Add(value uint16) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Uint16Set) Contains

func (s Uint16Set) Contains(value uint16) bool

Contains returns true if this set contains the specified element

func (Uint16Set) Len

func (s Uint16Set) Len() int

func (Uint16Set) Range

func (s Uint16Set) Range(f func(value uint16) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Uint16Set) Remove

func (s Uint16Set) Remove(value uint16) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Uint32Set

type Uint32Set map[uint32]struct{}

func NewUint32

func NewUint32() Uint32Set

NewUint32 returns an empty uint32 set

func NewUint32WithSize

func NewUint32WithSize(size int) Uint32Set

NewUint32WithSize returns an empty uint32 set initialized with specific size

func (Uint32Set) Add

func (s Uint32Set) Add(value uint32) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Uint32Set) Contains

func (s Uint32Set) Contains(value uint32) bool

Contains returns true if this set contains the specified element

func (Uint32Set) Len

func (s Uint32Set) Len() int

func (Uint32Set) Range

func (s Uint32Set) Range(f func(value uint32) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Uint32Set) Remove

func (s Uint32Set) Remove(value uint32) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Uint64Set

type Uint64Set map[uint64]struct{}

func NewUint64

func NewUint64() Uint64Set

NewUint64 returns an empty uint64 set

func NewUint64WithSize

func NewUint64WithSize(size int) Uint64Set

NewUint64WithSize returns an empty uint64 set initialized with specific size

func (Uint64Set) Add

func (s Uint64Set) Add(value uint64) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Uint64Set) Contains

func (s Uint64Set) Contains(value uint64) bool

Contains returns true if this set contains the specified element

func (Uint64Set) Len

func (s Uint64Set) Len() int

func (Uint64Set) Range

func (s Uint64Set) Range(f func(value uint64) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Uint64Set) Remove

func (s Uint64Set) Remove(value uint64) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type Uint8Set added in v1.2.6

type Uint8Set map[uint8]struct{}

func NewUint8 added in v1.2.6

func NewUint8() Uint8Set

NewUint8 returns an empty uint8 set

func NewUint8WithSize added in v1.2.6

func NewUint8WithSize(size int) Uint8Set

NewUint8WithSize returns an empty uint8 set initialized with specific size

func (Uint8Set) Add added in v1.2.6

func (s Uint8Set) Add(value uint8) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (Uint8Set) Contains added in v1.2.6

func (s Uint8Set) Contains(value uint8) bool

Contains returns true if this set contains the specified element

func (Uint8Set) Len added in v1.2.6

func (s Uint8Set) Len() int

func (Uint8Set) Range added in v1.2.6

func (s Uint8Set) Range(f func(value uint8) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (Uint8Set) Remove added in v1.2.6

func (s Uint8Set) Remove(value uint8) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type UintSet

type UintSet map[uint]struct{}

func NewUint

func NewUint() UintSet

NewUint returns an empty uint set

func NewUintWithSize

func NewUintWithSize(size int) UintSet

NewUintWithSize returns an empty uint set initialized with specific size

func (UintSet) Add

func (s UintSet) Add(value uint) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (UintSet) Contains

func (s UintSet) Contains(value uint) bool

Contains returns true if this set contains the specified element

func (UintSet) Len

func (s UintSet) Len() int

func (UintSet) Range

func (s UintSet) Range(f func(value uint) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (UintSet) Remove

func (s UintSet) Remove(value uint) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

type UintptrSet added in v1.2.6

type UintptrSet map[uintptr]struct{}

func NewUintptr added in v1.2.6

func NewUintptr() UintptrSet

NewUintptr returns an empty uintptr set

func NewUintptrWithSize added in v1.2.6

func NewUintptrWithSize(size int) UintptrSet

NewUintptrWithSize returns an empty uintptr set initialized with specific size

func (UintptrSet) Add added in v1.2.6

func (s UintptrSet) Add(value uintptr) bool

Add adds the specified element to this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

func (UintptrSet) Contains added in v1.2.6

func (s UintptrSet) Contains(value uintptr) bool

Contains returns true if this set contains the specified element

func (UintptrSet) Len added in v1.2.6

func (s UintptrSet) Len() int

func (UintptrSet) Range added in v1.2.6

func (s UintptrSet) Range(f func(value uintptr) bool)

Range calls f sequentially for each value present in the hashset. If f returns false, range stops the iteration.

func (UintptrSet) Remove added in v1.2.6

func (s UintptrSet) Remove(value uintptr) bool

Remove removes the specified element from this set Always returns true due to the build-in map doesn't indicate caller whether the given element already exists Reserves the return type for future extension

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL