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

     1  package corestr
     2  
     3  type newLinkedListCreator struct{}
     4  
     5  func (it *newLinkedListCreator) Create() *LinkedList {
     6  	return &LinkedList{}
     7  }
     8  
     9  func (it *newLinkedListCreator) Empty() *LinkedList {
    10  	return &LinkedList{}
    11  }
    12  
    13  func (it *newLinkedListCreator) PointerStringsPtr(
    14  	stringItems *[]*string,
    15  ) *LinkedList {
    16  	if stringItems == nil || len(*stringItems) == 0 {
    17  		return &LinkedList{}
    18  	}
    19  
    20  	linkedList := it.Empty()
    21  
    22  	return linkedList.
    23  		AddPointerStringsPtr(stringItems)
    24  }
    25  
    26  func (it *newLinkedListCreator) Strings(
    27  	stringItems []string,
    28  ) *LinkedList {
    29  	if len(stringItems) == 0 {
    30  		return &LinkedList{}
    31  	}
    32  
    33  	linkedList := it.Create()
    34  
    35  	return linkedList.
    36  		AddStrings(stringItems...)
    37  }
    38  
    39  func (it *newLinkedListCreator) SpreadStrings(
    40  	stringItems ...string,
    41  ) *LinkedList {
    42  	if len(stringItems) == 0 {
    43  		return &LinkedList{}
    44  	}
    45  
    46  	linkedList := it.Create()
    47  
    48  	return linkedList.
    49  		AddStrings(stringItems...)
    50  }
    51  
    52  func (it *newLinkedListCreator) UsingMap(
    53  	itemsMap map[string]bool,
    54  ) *LinkedList {
    55  	if itemsMap == nil {
    56  		return &LinkedList{}
    57  	}
    58  
    59  	linkedList := it.Create()
    60  
    61  	return linkedList.
    62  		AddItemsMap(itemsMap)
    63  }
    64  
    65  func (it *newLinkedListCreator) StringsPtr(
    66  	stringItems *[]string,
    67  ) *LinkedList {
    68  	if stringItems == nil {
    69  		return &LinkedList{}
    70  	}
    71  
    72  	linkedList := it.Create()
    73  
    74  	return linkedList.
    75  		AddStringsPtr(stringItems)
    76  }