gitlab.com/evatix-go/core@v1.3.55/coredata/corestr/newHashsetsCollectionCreator.go (about)

     1  package corestr
     2  
     3  import "gitlab.com/evatix-go/core/constants"
     4  
     5  type newHashsetsCollectionCreator struct{}
     6  
     7  func (it *newHashsetsCollectionCreator) Empty() *HashsetsCollection {
     8  	collection := make(
     9  		[]*Hashset,
    10  		constants.Zero,
    11  		constants.Zero)
    12  
    13  	return &HashsetsCollection{
    14  		items: collection,
    15  	}
    16  }
    17  
    18  func (it *newHashsetsCollectionCreator) UsingHashsets(
    19  	hashsets ...Hashset,
    20  ) *HashsetsCollection {
    21  	length := len(hashsets)
    22  
    23  	if length == 0 {
    24  		return it.Empty()
    25  	}
    26  
    27  	collection := make(
    28  		[]*Hashset,
    29  		length,
    30  		length+constants.ArbitraryCapacity10)
    31  
    32  	for i := range hashsets {
    33  		collection[i] = &hashsets[i]
    34  	}
    35  
    36  	return &HashsetsCollection{
    37  		items: collection,
    38  	}
    39  }
    40  
    41  func (it *newHashsetsCollectionCreator) UsingHashsetsPointers(
    42  	hashsets ...*Hashset,
    43  ) *HashsetsCollection {
    44  	if len(hashsets) == 0 {
    45  		return it.Empty()
    46  	}
    47  
    48  	return &HashsetsCollection{
    49  		items: hashsets,
    50  	}
    51  }
    52  
    53  func (it *newHashsetsCollectionCreator) LenCap(
    54  	length, capacity int,
    55  ) *HashsetsCollection {
    56  	collection := make([]*Hashset, length, capacity)
    57  
    58  	return &HashsetsCollection{
    59  		items: collection,
    60  	}
    61  }
    62  
    63  func (it *newHashsetsCollectionCreator) Cap(
    64  	capacity int,
    65  ) *HashsetsCollection {
    66  	collection := make([]*Hashset, constants.Zero, capacity)
    67  
    68  	return &HashsetsCollection{
    69  		items: collection,
    70  	}
    71  }