github.com/songzhibin97/gkit@v1.2.13/structure/hashset/types.go (about)

     1  // Copyright 2021 ByteDance Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Code generated by go run types_gen.go; DO NOT EDIT.
    16  
    17  package hashset
    18  
    19  type ByteSet map[byte]struct{}
    20  
    21  // NewByte returns an empty byte set
    22  func NewByte() ByteSet {
    23  	return make(map[byte]struct{})
    24  }
    25  
    26  // NewByteWithSize returns an empty byte set initialized with specific size
    27  func NewByteWithSize(size int) ByteSet {
    28  	return make(map[byte]struct{}, size)
    29  }
    30  
    31  // Add adds the specified element to this set
    32  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
    33  // Reserves the return type for future extension
    34  func (s ByteSet) Add(value byte) bool {
    35  	s[value] = struct{}{}
    36  	return true
    37  }
    38  
    39  // Contains returns true if this set contains the specified element
    40  func (s ByteSet) Contains(value byte) bool {
    41  	if _, ok := s[value]; ok {
    42  		return true
    43  	}
    44  	return false
    45  }
    46  
    47  // Remove removes the specified element from this set
    48  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
    49  // Reserves the return type for future extension
    50  func (s ByteSet) Remove(value byte) bool {
    51  	delete(s, value)
    52  	return true
    53  }
    54  
    55  // Range calls f sequentially for each value present in the hashset.
    56  // If f returns false, range stops the iteration.
    57  func (s ByteSet) Range(f func(value byte) bool) {
    58  	for k := range s {
    59  		if !f(k) {
    60  			break
    61  		}
    62  	}
    63  }
    64  
    65  // Len returns the number of elements of this set
    66  
    67  func (s ByteSet) Len() int {
    68  	return len(s)
    69  }
    70  
    71  type Complex64Set map[complex64]struct{}
    72  
    73  // NewComplex64 returns an empty complex64 set
    74  func NewComplex64() Complex64Set {
    75  	return make(map[complex64]struct{})
    76  }
    77  
    78  // NewComplex64WithSize returns an empty complex64 set initialized with specific size
    79  func NewComplex64WithSize(size int) Complex64Set {
    80  	return make(map[complex64]struct{}, size)
    81  }
    82  
    83  // Add adds the specified element to this set
    84  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
    85  // Reserves the return type for future extension
    86  func (s Complex64Set) Add(value complex64) bool {
    87  	s[value] = struct{}{}
    88  	return true
    89  }
    90  
    91  // Contains returns true if this set contains the specified element
    92  func (s Complex64Set) Contains(value complex64) bool {
    93  	if _, ok := s[value]; ok {
    94  		return true
    95  	}
    96  	return false
    97  }
    98  
    99  // Remove removes the specified element from this set
   100  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   101  // Reserves the return type for future extension
   102  func (s Complex64Set) Remove(value complex64) bool {
   103  	delete(s, value)
   104  	return true
   105  }
   106  
   107  // Range calls f sequentially for each value present in the hashset.
   108  // If f returns false, range stops the iteration.
   109  func (s Complex64Set) Range(f func(value complex64) bool) {
   110  	for k := range s {
   111  		if !f(k) {
   112  			break
   113  		}
   114  	}
   115  }
   116  
   117  // Len returns the number of elements of this set
   118  
   119  func (s Complex64Set) Len() int {
   120  	return len(s)
   121  }
   122  
   123  type Complex128Set map[complex128]struct{}
   124  
   125  // NewComplex128 returns an empty complex128 set
   126  func NewComplex128() Complex128Set {
   127  	return make(map[complex128]struct{})
   128  }
   129  
   130  // NewComplex128WithSize returns an empty complex128 set initialized with specific size
   131  func NewComplex128WithSize(size int) Complex128Set {
   132  	return make(map[complex128]struct{}, size)
   133  }
   134  
   135  // Add adds the specified element to this set
   136  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   137  // Reserves the return type for future extension
   138  func (s Complex128Set) Add(value complex128) bool {
   139  	s[value] = struct{}{}
   140  	return true
   141  }
   142  
   143  // Contains returns true if this set contains the specified element
   144  func (s Complex128Set) Contains(value complex128) bool {
   145  	if _, ok := s[value]; ok {
   146  		return true
   147  	}
   148  	return false
   149  }
   150  
   151  // Remove removes the specified element from this set
   152  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   153  // Reserves the return type for future extension
   154  func (s Complex128Set) Remove(value complex128) bool {
   155  	delete(s, value)
   156  	return true
   157  }
   158  
   159  // Range calls f sequentially for each value present in the hashset.
   160  // If f returns false, range stops the iteration.
   161  func (s Complex128Set) Range(f func(value complex128) bool) {
   162  	for k := range s {
   163  		if !f(k) {
   164  			break
   165  		}
   166  	}
   167  }
   168  
   169  // Len returns the number of elements of this set
   170  
   171  func (s Complex128Set) Len() int {
   172  	return len(s)
   173  }
   174  
   175  type Float32Set map[float32]struct{}
   176  
   177  // NewFloat32 returns an empty float32 set
   178  func NewFloat32() Float32Set {
   179  	return make(map[float32]struct{})
   180  }
   181  
   182  // NewFloat32WithSize returns an empty float32 set initialized with specific size
   183  func NewFloat32WithSize(size int) Float32Set {
   184  	return make(map[float32]struct{}, size)
   185  }
   186  
   187  // Add adds the specified element to this set
   188  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   189  // Reserves the return type for future extension
   190  func (s Float32Set) Add(value float32) bool {
   191  	s[value] = struct{}{}
   192  	return true
   193  }
   194  
   195  // Contains returns true if this set contains the specified element
   196  func (s Float32Set) Contains(value float32) bool {
   197  	if _, ok := s[value]; ok {
   198  		return true
   199  	}
   200  	return false
   201  }
   202  
   203  // Remove removes the specified element from this set
   204  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   205  // Reserves the return type for future extension
   206  func (s Float32Set) Remove(value float32) bool {
   207  	delete(s, value)
   208  	return true
   209  }
   210  
   211  // Range calls f sequentially for each value present in the hashset.
   212  // If f returns false, range stops the iteration.
   213  func (s Float32Set) Range(f func(value float32) bool) {
   214  	for k := range s {
   215  		if !f(k) {
   216  			break
   217  		}
   218  	}
   219  }
   220  
   221  // Len returns the number of elements of this set
   222  
   223  func (s Float32Set) Len() int {
   224  	return len(s)
   225  }
   226  
   227  type Float64Set map[float64]struct{}
   228  
   229  // NewFloat64 returns an empty float64 set
   230  func NewFloat64() Float64Set {
   231  	return make(map[float64]struct{})
   232  }
   233  
   234  // NewFloat64WithSize returns an empty float64 set initialized with specific size
   235  func NewFloat64WithSize(size int) Float64Set {
   236  	return make(map[float64]struct{}, size)
   237  }
   238  
   239  // Add adds the specified element to this set
   240  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   241  // Reserves the return type for future extension
   242  func (s Float64Set) Add(value float64) bool {
   243  	s[value] = struct{}{}
   244  	return true
   245  }
   246  
   247  // Contains returns true if this set contains the specified element
   248  func (s Float64Set) Contains(value float64) bool {
   249  	if _, ok := s[value]; ok {
   250  		return true
   251  	}
   252  	return false
   253  }
   254  
   255  // Remove removes the specified element from this set
   256  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   257  // Reserves the return type for future extension
   258  func (s Float64Set) Remove(value float64) bool {
   259  	delete(s, value)
   260  	return true
   261  }
   262  
   263  // Range calls f sequentially for each value present in the hashset.
   264  // If f returns false, range stops the iteration.
   265  func (s Float64Set) Range(f func(value float64) bool) {
   266  	for k := range s {
   267  		if !f(k) {
   268  			break
   269  		}
   270  	}
   271  }
   272  
   273  // Len returns the number of elements of this set
   274  
   275  func (s Float64Set) Len() int {
   276  	return len(s)
   277  }
   278  
   279  type IntSet map[int]struct{}
   280  
   281  // NewInt returns an empty int set
   282  func NewInt() IntSet {
   283  	return make(map[int]struct{})
   284  }
   285  
   286  // NewIntWithSize returns an empty int set initialized with specific size
   287  func NewIntWithSize(size int) IntSet {
   288  	return make(map[int]struct{}, size)
   289  }
   290  
   291  // Add adds the specified element to this set
   292  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   293  // Reserves the return type for future extension
   294  func (s IntSet) Add(value int) bool {
   295  	s[value] = struct{}{}
   296  	return true
   297  }
   298  
   299  // Contains returns true if this set contains the specified element
   300  func (s IntSet) Contains(value int) bool {
   301  	if _, ok := s[value]; ok {
   302  		return true
   303  	}
   304  	return false
   305  }
   306  
   307  // Remove removes the specified element from this set
   308  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   309  // Reserves the return type for future extension
   310  func (s IntSet) Remove(value int) bool {
   311  	delete(s, value)
   312  	return true
   313  }
   314  
   315  // Range calls f sequentially for each value present in the hashset.
   316  // If f returns false, range stops the iteration.
   317  func (s IntSet) Range(f func(value int) bool) {
   318  	for k := range s {
   319  		if !f(k) {
   320  			break
   321  		}
   322  	}
   323  }
   324  
   325  // Len returns the number of elements of this set
   326  
   327  func (s IntSet) Len() int {
   328  	return len(s)
   329  }
   330  
   331  type Int8Set map[int8]struct{}
   332  
   333  // NewInt8 returns an empty int8 set
   334  func NewInt8() Int8Set {
   335  	return make(map[int8]struct{})
   336  }
   337  
   338  // NewInt8WithSize returns an empty int8 set initialized with specific size
   339  func NewInt8WithSize(size int) Int8Set {
   340  	return make(map[int8]struct{}, size)
   341  }
   342  
   343  // Add adds the specified element to this set
   344  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   345  // Reserves the return type for future extension
   346  func (s Int8Set) Add(value int8) bool {
   347  	s[value] = struct{}{}
   348  	return true
   349  }
   350  
   351  // Contains returns true if this set contains the specified element
   352  func (s Int8Set) Contains(value int8) bool {
   353  	if _, ok := s[value]; ok {
   354  		return true
   355  	}
   356  	return false
   357  }
   358  
   359  // Remove removes the specified element from this set
   360  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   361  // Reserves the return type for future extension
   362  func (s Int8Set) Remove(value int8) bool {
   363  	delete(s, value)
   364  	return true
   365  }
   366  
   367  // Range calls f sequentially for each value present in the hashset.
   368  // If f returns false, range stops the iteration.
   369  func (s Int8Set) Range(f func(value int8) bool) {
   370  	for k := range s {
   371  		if !f(k) {
   372  			break
   373  		}
   374  	}
   375  }
   376  
   377  // Len returns the number of elements of this set
   378  
   379  func (s Int8Set) Len() int {
   380  	return len(s)
   381  }
   382  
   383  type Int16Set map[int16]struct{}
   384  
   385  // NewInt16 returns an empty int16 set
   386  func NewInt16() Int16Set {
   387  	return make(map[int16]struct{})
   388  }
   389  
   390  // NewInt16WithSize returns an empty int16 set initialized with specific size
   391  func NewInt16WithSize(size int) Int16Set {
   392  	return make(map[int16]struct{}, size)
   393  }
   394  
   395  // Add adds the specified element to this set
   396  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   397  // Reserves the return type for future extension
   398  func (s Int16Set) Add(value int16) bool {
   399  	s[value] = struct{}{}
   400  	return true
   401  }
   402  
   403  // Contains returns true if this set contains the specified element
   404  func (s Int16Set) Contains(value int16) bool {
   405  	if _, ok := s[value]; ok {
   406  		return true
   407  	}
   408  	return false
   409  }
   410  
   411  // Remove removes the specified element from this set
   412  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   413  // Reserves the return type for future extension
   414  func (s Int16Set) Remove(value int16) bool {
   415  	delete(s, value)
   416  	return true
   417  }
   418  
   419  // Range calls f sequentially for each value present in the hashset.
   420  // If f returns false, range stops the iteration.
   421  func (s Int16Set) Range(f func(value int16) bool) {
   422  	for k := range s {
   423  		if !f(k) {
   424  			break
   425  		}
   426  	}
   427  }
   428  
   429  // Len returns the number of elements of this set
   430  
   431  func (s Int16Set) Len() int {
   432  	return len(s)
   433  }
   434  
   435  type Int32Set map[int32]struct{}
   436  
   437  // NewInt32 returns an empty int32 set
   438  func NewInt32() Int32Set {
   439  	return make(map[int32]struct{})
   440  }
   441  
   442  // NewInt32WithSize returns an empty int32 set initialized with specific size
   443  func NewInt32WithSize(size int) Int32Set {
   444  	return make(map[int32]struct{}, size)
   445  }
   446  
   447  // Add adds the specified element to this set
   448  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   449  // Reserves the return type for future extension
   450  func (s Int32Set) Add(value int32) bool {
   451  	s[value] = struct{}{}
   452  	return true
   453  }
   454  
   455  // Contains returns true if this set contains the specified element
   456  func (s Int32Set) Contains(value int32) bool {
   457  	if _, ok := s[value]; ok {
   458  		return true
   459  	}
   460  	return false
   461  }
   462  
   463  // Remove removes the specified element from this set
   464  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   465  // Reserves the return type for future extension
   466  func (s Int32Set) Remove(value int32) bool {
   467  	delete(s, value)
   468  	return true
   469  }
   470  
   471  // Range calls f sequentially for each value present in the hashset.
   472  // If f returns false, range stops the iteration.
   473  func (s Int32Set) Range(f func(value int32) bool) {
   474  	for k := range s {
   475  		if !f(k) {
   476  			break
   477  		}
   478  	}
   479  }
   480  
   481  // Len returns the number of elements of this set
   482  
   483  func (s Int32Set) Len() int {
   484  	return len(s)
   485  }
   486  
   487  type RuneSet map[rune]struct{}
   488  
   489  // NewRune returns an empty rune set
   490  func NewRune() RuneSet {
   491  	return make(map[rune]struct{})
   492  }
   493  
   494  // NewRuneWithSize returns an empty rune set initialized with specific size
   495  func NewRuneWithSize(size int) RuneSet {
   496  	return make(map[rune]struct{}, size)
   497  }
   498  
   499  // Add adds the specified element to this set
   500  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   501  // Reserves the return type for future extension
   502  func (s RuneSet) Add(value rune) bool {
   503  	s[value] = struct{}{}
   504  	return true
   505  }
   506  
   507  // Contains returns true if this set contains the specified element
   508  func (s RuneSet) Contains(value rune) bool {
   509  	if _, ok := s[value]; ok {
   510  		return true
   511  	}
   512  	return false
   513  }
   514  
   515  // Remove removes the specified element from this set
   516  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   517  // Reserves the return type for future extension
   518  func (s RuneSet) Remove(value rune) bool {
   519  	delete(s, value)
   520  	return true
   521  }
   522  
   523  // Range calls f sequentially for each value present in the hashset.
   524  // If f returns false, range stops the iteration.
   525  func (s RuneSet) Range(f func(value rune) bool) {
   526  	for k := range s {
   527  		if !f(k) {
   528  			break
   529  		}
   530  	}
   531  }
   532  
   533  // Len returns the number of elements of this set
   534  
   535  func (s RuneSet) Len() int {
   536  	return len(s)
   537  }
   538  
   539  type StringSet map[string]struct{}
   540  
   541  // NewString returns an empty string set
   542  func NewString() StringSet {
   543  	return make(map[string]struct{})
   544  }
   545  
   546  // NewStringWithSize returns an empty string set initialized with specific size
   547  func NewStringWithSize(size int) StringSet {
   548  	return make(map[string]struct{}, size)
   549  }
   550  
   551  // Add adds the specified element to this set
   552  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   553  // Reserves the return type for future extension
   554  func (s StringSet) Add(value string) bool {
   555  	s[value] = struct{}{}
   556  	return true
   557  }
   558  
   559  // Contains returns true if this set contains the specified element
   560  func (s StringSet) Contains(value string) bool {
   561  	if _, ok := s[value]; ok {
   562  		return true
   563  	}
   564  	return false
   565  }
   566  
   567  // Remove removes the specified element from this set
   568  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   569  // Reserves the return type for future extension
   570  func (s StringSet) Remove(value string) bool {
   571  	delete(s, value)
   572  	return true
   573  }
   574  
   575  // Range calls f sequentially for each value present in the hashset.
   576  // If f returns false, range stops the iteration.
   577  func (s StringSet) Range(f func(value string) bool) {
   578  	for k := range s {
   579  		if !f(k) {
   580  			break
   581  		}
   582  	}
   583  }
   584  
   585  // Len returns the number of elements of this set
   586  
   587  func (s StringSet) Len() int {
   588  	return len(s)
   589  }
   590  
   591  type UintSet map[uint]struct{}
   592  
   593  // NewUint returns an empty uint set
   594  func NewUint() UintSet {
   595  	return make(map[uint]struct{})
   596  }
   597  
   598  // NewUintWithSize returns an empty uint set initialized with specific size
   599  func NewUintWithSize(size int) UintSet {
   600  	return make(map[uint]struct{}, size)
   601  }
   602  
   603  // Add adds the specified element to this set
   604  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   605  // Reserves the return type for future extension
   606  func (s UintSet) Add(value uint) bool {
   607  	s[value] = struct{}{}
   608  	return true
   609  }
   610  
   611  // Contains returns true if this set contains the specified element
   612  func (s UintSet) Contains(value uint) bool {
   613  	if _, ok := s[value]; ok {
   614  		return true
   615  	}
   616  	return false
   617  }
   618  
   619  // Remove removes the specified element from this set
   620  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   621  // Reserves the return type for future extension
   622  func (s UintSet) Remove(value uint) bool {
   623  	delete(s, value)
   624  	return true
   625  }
   626  
   627  // Range calls f sequentially for each value present in the hashset.
   628  // If f returns false, range stops the iteration.
   629  func (s UintSet) Range(f func(value uint) bool) {
   630  	for k := range s {
   631  		if !f(k) {
   632  			break
   633  		}
   634  	}
   635  }
   636  
   637  // Len returns the number of elements of this set
   638  
   639  func (s UintSet) Len() int {
   640  	return len(s)
   641  }
   642  
   643  type Uint8Set map[uint8]struct{}
   644  
   645  // NewUint8 returns an empty uint8 set
   646  func NewUint8() Uint8Set {
   647  	return make(map[uint8]struct{})
   648  }
   649  
   650  // NewUint8WithSize returns an empty uint8 set initialized with specific size
   651  func NewUint8WithSize(size int) Uint8Set {
   652  	return make(map[uint8]struct{}, size)
   653  }
   654  
   655  // Add adds the specified element to this set
   656  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   657  // Reserves the return type for future extension
   658  func (s Uint8Set) Add(value uint8) bool {
   659  	s[value] = struct{}{}
   660  	return true
   661  }
   662  
   663  // Contains returns true if this set contains the specified element
   664  func (s Uint8Set) Contains(value uint8) bool {
   665  	if _, ok := s[value]; ok {
   666  		return true
   667  	}
   668  	return false
   669  }
   670  
   671  // Remove removes the specified element from this set
   672  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   673  // Reserves the return type for future extension
   674  func (s Uint8Set) Remove(value uint8) bool {
   675  	delete(s, value)
   676  	return true
   677  }
   678  
   679  // Range calls f sequentially for each value present in the hashset.
   680  // If f returns false, range stops the iteration.
   681  func (s Uint8Set) Range(f func(value uint8) bool) {
   682  	for k := range s {
   683  		if !f(k) {
   684  			break
   685  		}
   686  	}
   687  }
   688  
   689  // Len returns the number of elements of this set
   690  
   691  func (s Uint8Set) Len() int {
   692  	return len(s)
   693  }
   694  
   695  type Uint16Set map[uint16]struct{}
   696  
   697  // NewUint16 returns an empty uint16 set
   698  func NewUint16() Uint16Set {
   699  	return make(map[uint16]struct{})
   700  }
   701  
   702  // NewUint16WithSize returns an empty uint16 set initialized with specific size
   703  func NewUint16WithSize(size int) Uint16Set {
   704  	return make(map[uint16]struct{}, size)
   705  }
   706  
   707  // Add adds the specified element to this set
   708  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   709  // Reserves the return type for future extension
   710  func (s Uint16Set) Add(value uint16) bool {
   711  	s[value] = struct{}{}
   712  	return true
   713  }
   714  
   715  // Contains returns true if this set contains the specified element
   716  func (s Uint16Set) Contains(value uint16) bool {
   717  	if _, ok := s[value]; ok {
   718  		return true
   719  	}
   720  	return false
   721  }
   722  
   723  // Remove removes the specified element from this set
   724  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   725  // Reserves the return type for future extension
   726  func (s Uint16Set) Remove(value uint16) bool {
   727  	delete(s, value)
   728  	return true
   729  }
   730  
   731  // Range calls f sequentially for each value present in the hashset.
   732  // If f returns false, range stops the iteration.
   733  func (s Uint16Set) Range(f func(value uint16) bool) {
   734  	for k := range s {
   735  		if !f(k) {
   736  			break
   737  		}
   738  	}
   739  }
   740  
   741  // Len returns the number of elements of this set
   742  
   743  func (s Uint16Set) Len() int {
   744  	return len(s)
   745  }
   746  
   747  type Uint32Set map[uint32]struct{}
   748  
   749  // NewUint32 returns an empty uint32 set
   750  func NewUint32() Uint32Set {
   751  	return make(map[uint32]struct{})
   752  }
   753  
   754  // NewUint32WithSize returns an empty uint32 set initialized with specific size
   755  func NewUint32WithSize(size int) Uint32Set {
   756  	return make(map[uint32]struct{}, size)
   757  }
   758  
   759  // Add adds the specified element to this set
   760  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   761  // Reserves the return type for future extension
   762  func (s Uint32Set) Add(value uint32) bool {
   763  	s[value] = struct{}{}
   764  	return true
   765  }
   766  
   767  // Contains returns true if this set contains the specified element
   768  func (s Uint32Set) Contains(value uint32) bool {
   769  	if _, ok := s[value]; ok {
   770  		return true
   771  	}
   772  	return false
   773  }
   774  
   775  // Remove removes the specified element from this set
   776  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   777  // Reserves the return type for future extension
   778  func (s Uint32Set) Remove(value uint32) bool {
   779  	delete(s, value)
   780  	return true
   781  }
   782  
   783  // Range calls f sequentially for each value present in the hashset.
   784  // If f returns false, range stops the iteration.
   785  func (s Uint32Set) Range(f func(value uint32) bool) {
   786  	for k := range s {
   787  		if !f(k) {
   788  			break
   789  		}
   790  	}
   791  }
   792  
   793  // Len returns the number of elements of this set
   794  
   795  func (s Uint32Set) Len() int {
   796  	return len(s)
   797  }
   798  
   799  type Uint64Set map[uint64]struct{}
   800  
   801  // NewUint64 returns an empty uint64 set
   802  func NewUint64() Uint64Set {
   803  	return make(map[uint64]struct{})
   804  }
   805  
   806  // NewUint64WithSize returns an empty uint64 set initialized with specific size
   807  func NewUint64WithSize(size int) Uint64Set {
   808  	return make(map[uint64]struct{}, size)
   809  }
   810  
   811  // Add adds the specified element to this set
   812  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   813  // Reserves the return type for future extension
   814  func (s Uint64Set) Add(value uint64) bool {
   815  	s[value] = struct{}{}
   816  	return true
   817  }
   818  
   819  // Contains returns true if this set contains the specified element
   820  func (s Uint64Set) Contains(value uint64) bool {
   821  	if _, ok := s[value]; ok {
   822  		return true
   823  	}
   824  	return false
   825  }
   826  
   827  // Remove removes the specified element from this set
   828  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   829  // Reserves the return type for future extension
   830  func (s Uint64Set) Remove(value uint64) bool {
   831  	delete(s, value)
   832  	return true
   833  }
   834  
   835  // Range calls f sequentially for each value present in the hashset.
   836  // If f returns false, range stops the iteration.
   837  func (s Uint64Set) Range(f func(value uint64) bool) {
   838  	for k := range s {
   839  		if !f(k) {
   840  			break
   841  		}
   842  	}
   843  }
   844  
   845  // Len returns the number of elements of this set
   846  
   847  func (s Uint64Set) Len() int {
   848  	return len(s)
   849  }
   850  
   851  type UintptrSet map[uintptr]struct{}
   852  
   853  // NewUintptr returns an empty uintptr set
   854  func NewUintptr() UintptrSet {
   855  	return make(map[uintptr]struct{})
   856  }
   857  
   858  // NewUintptrWithSize returns an empty uintptr set initialized with specific size
   859  func NewUintptrWithSize(size int) UintptrSet {
   860  	return make(map[uintptr]struct{}, size)
   861  }
   862  
   863  // Add adds the specified element to this set
   864  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   865  // Reserves the return type for future extension
   866  func (s UintptrSet) Add(value uintptr) bool {
   867  	s[value] = struct{}{}
   868  	return true
   869  }
   870  
   871  // Contains returns true if this set contains the specified element
   872  func (s UintptrSet) Contains(value uintptr) bool {
   873  	if _, ok := s[value]; ok {
   874  		return true
   875  	}
   876  	return false
   877  }
   878  
   879  // Remove removes the specified element from this set
   880  // Always returns true due to the build-in map doesn't indicate caller whether the given element already exists
   881  // Reserves the return type for future extension
   882  func (s UintptrSet) Remove(value uintptr) bool {
   883  	delete(s, value)
   884  	return true
   885  }
   886  
   887  // Range calls f sequentially for each value present in the hashset.
   888  // If f returns false, range stops the iteration.
   889  func (s UintptrSet) Range(f func(value uintptr) bool) {
   890  	for k := range s {
   891  		if !f(k) {
   892  			break
   893  		}
   894  	}
   895  }
   896  
   897  // Len returns the number of elements of this set
   898  
   899  func (s UintptrSet) Len() int {
   900  	return len(s)
   901  }