Documentation ¶
Index ¶
- type Int64Set
- func (set Int64Set) Add(i ...int64) Int64Set
- func (set Int64Set) Append(more ...int64) Int64Set
- func (set Int64Set) Cardinality() int
- func (set *Int64Set) Clear()
- func (set Int64Set) Clone() Int64Set
- func (set Int64Set) Contains(i int64) bool
- func (set Int64Set) ContainsAll(i ...int64) bool
- func (set Int64Set) CountBy(predicate func(int64) bool) (result int)
- func (set Int64Set) Difference(other Int64Set) Int64Set
- func (set Int64Set) Equals(other Int64Set) bool
- func (set Int64Set) Exists(fn func(int64) bool) bool
- func (set Int64Set) Filter(fn func(int64) bool) Int64Set
- func (set Int64Set) FlatMap(fn func(int64) []int64) Int64Set
- func (set Int64Set) Forall(fn func(int64) bool) bool
- func (set Int64Set) Foreach(fn func(int64))
- func (set Int64Set) Intersect(other Int64Set) Int64Set
- func (set Int64Set) IsEmpty() bool
- func (set Int64Set) IsSequence() bool
- func (set Int64Set) IsSet() bool
- func (set Int64Set) IsSubset(other Int64Set) bool
- func (set Int64Set) IsSuperset(other Int64Set) bool
- func (set Int64Set) Map(fn func(int64) int64) Int64Set
- func (list Int64Set) Max() (result int64)
- func (set Int64Set) MaxBy(less func(int64, int64) bool) int64
- func (list Int64Set) Min() int64
- func (set Int64Set) MinBy(less func(int64, int64) bool) int64
- func (set Int64Set) NonEmpty() bool
- func (set Int64Set) Partition(p func(int64) bool) (Int64Set, Int64Set)
- func (set Int64Set) Remove(i int64)
- func (set Int64Set) Send() <-chan int64
- func (set Int64Set) Size() int
- func (set Int64Set) Sum() int64
- func (set Int64Set) SymmetricDifference(other Int64Set) Int64Set
- func (set Int64Set) ToInterfaceSlice() []interface{}
- func (set Int64Set) ToSlice() []int64
- func (set Int64Set) Union(other Int64Set) Int64Set
- type StringAnyMap
- func (mm *StringAnyMap) Clear()
- func (mm StringAnyMap) Clone() StringAnyMap
- func (mm StringAnyMap) ContainsAllKeys(kk ...string) bool
- func (mm StringAnyMap) ContainsKey(k string) bool
- func (mm StringAnyMap) DropWhere(fn func(string, interface{}) bool) StringAnyTuples
- func (mm StringAnyMap) Exists(fn func(string, interface{}) bool) bool
- func (mm StringAnyMap) Filter(fn func(string, interface{}) bool) StringAnyMap
- func (mm StringAnyMap) Find(fn func(string, interface{}) bool) (StringAnyTuple, bool)
- func (mm StringAnyMap) FlatMap(fn func(string, interface{}) []StringAnyTuple) StringAnyMap
- func (mm StringAnyMap) Forall(fn func(string, interface{}) bool) bool
- func (mm StringAnyMap) Foreach(fn func(string, interface{}))
- func (mm StringAnyMap) Get(k string) (interface{}, bool)
- func (mm StringAnyMap) IsEmpty() bool
- func (mm StringAnyMap) Keys() []string
- func (mm StringAnyMap) Map(fn func(string, interface{}) (string, interface{})) StringAnyMap
- func (mm StringAnyMap) NonEmpty() bool
- func (mm StringAnyMap) Partition(fn func(string, interface{}) bool) (matching StringAnyMap, others StringAnyMap)
- func (mm StringAnyMap) Pop(k string) (interface{}, bool)
- func (mm StringAnyMap) Put(k string, v interface{}) bool
- func (mm StringAnyMap) Remove(k string)
- func (mm StringAnyMap) Size() int
- func (mm StringAnyMap) ToSlice() []StringAnyTuple
- func (mm StringAnyMap) Values() []interface{}
- type StringAnyTuple
- type StringAnyTuples
- type StringList
- func (list StringList) Clone() StringList
- func (list StringList) Contains(v string) bool
- func (list StringList) ContainsAll(i ...string) bool
- func (list StringList) CountBy(predicate func(string) bool) (result int)
- func (list StringList) DistinctBy(equal func(string, string) bool) StringList
- func (list StringList) Drop(n int) StringList
- func (list StringList) DropLast(n int) StringList
- func (list StringList) DropWhile(p func(string) bool) StringList
- func (list StringList) Equals(other StringList) bool
- func (list StringList) Exists(fn func(string) bool) bool
- func (list StringList) Filter(fn func(string) bool) StringList
- func (list StringList) Find(fn func(string) bool) (string, bool)
- func (list StringList) FlatMap(fn func(string) []string) StringList
- func (list StringList) Forall(fn func(string) bool) bool
- func (list StringList) Foreach(fn func(string))
- func (list StringList) Get(i int) string
- func (list StringList) Head() string
- func (list StringList) IndexWhere(p func(string) bool) int
- func (list StringList) IndexWhere2(p func(string) bool, from int) int
- func (list StringList) Init() StringList
- func (list StringList) IsEmpty() bool
- func (list StringList) IsSequence() bool
- func (list StringList) IsSet() bool
- func (list StringList) Last() string
- func (list StringList) LastIndexWhere(p func(string) bool) int
- func (list StringList) LastIndexWhere2(p func(string) bool, before int) int
- func (list StringList) Len() int
- func (list StringList) Map(fn func(string) string) StringList
- func (list StringList) Max() (result string)
- func (list StringList) MaxBy(less func(string, string) bool) string
- func (list StringList) Min() string
- func (list StringList) MinBy(less func(string, string) bool) string
- func (list StringList) NonEmpty() bool
- func (list StringList) Partition(p func(string) bool) (StringList, StringList)
- func (list StringList) Reverse() StringList
- func (list StringList) Send() <-chan string
- func (list StringList) Shuffle() StringList
- func (list StringList) Size() int
- func (list StringList) SortBy(less func(i, j string) bool) StringList
- func (list StringList) Sorted() StringList
- func (list StringList) StableSortBy(less func(i, j string) bool) StringList
- func (list StringList) StableSorted() StringList
- func (list StringList) Swap(i, j int)
- func (list StringList) Tail() StringList
- func (list StringList) Take(n int) StringList
- func (list StringList) TakeLast(n int) StringList
- func (list StringList) TakeWhile(p func(string) bool) StringList
- func (list StringList) ToInterfaceSlice() []interface{}
- type StringSet
- func (set StringSet) Add(i ...string) StringSet
- func (set StringSet) Append(more ...string) StringSet
- func (set StringSet) Cardinality() int
- func (set *StringSet) Clear()
- func (set StringSet) Clone() StringSet
- func (set StringSet) Contains(i string) bool
- func (set StringSet) ContainsAll(i ...string) bool
- func (set StringSet) CountBy(predicate func(string) bool) (result int)
- func (set StringSet) Difference(other StringSet) StringSet
- func (set StringSet) Equals(other StringSet) bool
- func (set StringSet) Exists(fn func(string) bool) bool
- func (set StringSet) Filter(fn func(string) bool) StringSet
- func (set StringSet) FlatMap(fn func(string) []string) StringSet
- func (set StringSet) Forall(fn func(string) bool) bool
- func (set StringSet) Foreach(fn func(string))
- func (set StringSet) Intersect(other StringSet) StringSet
- func (set StringSet) IsEmpty() bool
- func (set StringSet) IsSequence() bool
- func (set StringSet) IsSet() bool
- func (set StringSet) IsSubset(other StringSet) bool
- func (set StringSet) IsSuperset(other StringSet) bool
- func (set StringSet) Map(fn func(string) string) StringSet
- func (list StringSet) Max() (result string)
- func (set StringSet) MaxBy(less func(string, string) bool) string
- func (list StringSet) Min() string
- func (set StringSet) MinBy(less func(string, string) bool) string
- func (set StringSet) NonEmpty() bool
- func (set StringSet) Partition(p func(string) bool) (StringSet, StringSet)
- func (set StringSet) Remove(i string)
- func (set StringSet) Send() <-chan string
- func (set StringSet) Size() int
- func (set StringSet) SymmetricDifference(other StringSet) StringSet
- func (set StringSet) ToInterfaceSlice() []interface{}
- func (set StringSet) ToSlice() []string
- func (set StringSet) Union(other StringSet) StringSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Int64Set ¶
type Int64Set map[int64]struct{}
Int64Set is the primary type that represents a set
func BuildInt64SetFromChan ¶
BuildInt64SetFromChan constructs a new Int64Set from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertInt64Set ¶
ConvertInt64Set constructs a new set containing the supplied values, if any. The returned boolean will be false if any of the values could not be converted correctly.
func NewInt64Set ¶
NewInt64Set creates and returns a reference to an empty set.
func (Int64Set) Cardinality ¶
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*Int64Set) Clear ¶
func (set *Int64Set) Clear()
Clear clears the entire set to be the empty set.
func (Int64Set) Clone ¶
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (Int64Set) ContainsAll ¶
ContainsAll determines if the given items are all in the set
func (Int64Set) CountBy ¶
CountBy gives the number elements of Int64Set that return true for the passed predicate.
func (Int64Set) Difference ¶
Difference returns a new set with items in the current set but not in the other set
func (Int64Set) Equals ¶
Equals determines if two sets are equal to each other. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal.
func (Int64Set) Exists ¶
Exists applies a predicate function to every element in the set. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (Int64Set) Filter ¶
Filter returns a new Int64Set whose elements return true for func. The original set is not modified
func (Int64Set) FlatMap ¶
FlatMap returns a new Int64Set by transforming every element with a function fn that returns zero or more items in a slice. The resulting list may have a different size to the original list. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64Set) Forall ¶
Forall applies a predicate function to every element in the set. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (Int64Set) Foreach ¶
Foreach iterates over int64Set and executes the passed func against each element.
func (Int64Set) IsSequence ¶
IsSequence returns true for lists.
func (Int64Set) IsSuperset ¶
IsSuperset determines if every item of this set is in the other set.
func (Int64Set) Map ¶
Map returns a new Int64Set by transforming every element with a function fn. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64Set) Max ¶
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (Int64Set) MaxBy ¶
MaxBy returns an element of Int64Set containing the maximum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally maximal, the first such element is returned. Panics if there are no elements.
func (Int64Set) Min ¶
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (Int64Set) MinBy ¶
MinBy returns an element of Int64Set containing the minimum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally minimal, the first such element is returned. Panics if there are no elements.
func (Int64Set) Partition ¶
Partition returns two new int64Sets whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list. The original set is not modified
func (Int64Set) Send ¶
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed
func (Int64Set) Size ¶
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (Int64Set) SymmetricDifference ¶
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (Int64Set) ToInterfaceSlice ¶
func (set Int64Set) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.
type StringAnyMap ¶
type StringAnyMap map[string]interface{}
StringAnyMap is the primary type that represents a map
func NewStringAnyMap ¶
func NewStringAnyMap(kv ...StringAnyTuple) StringAnyMap
NewStringAnyMap creates and returns a reference to a map, optionally containing some items.
func NewStringAnyMap1 ¶
func NewStringAnyMap1(k string, v interface{}) StringAnyMap
NewStringAnyMap creates and returns a reference to a map containing one item.
func (StringAnyMap) Clone ¶
func (mm StringAnyMap) Clone() StringAnyMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (StringAnyMap) ContainsAllKeys ¶
func (mm StringAnyMap) ContainsAllKeys(kk ...string) bool
ContainsAllKeys determines if the given items are all in the map.
func (StringAnyMap) ContainsKey ¶
func (mm StringAnyMap) ContainsKey(k string) bool
ContainsKey determines if a given item is already in the map.
func (StringAnyMap) DropWhere ¶
func (mm StringAnyMap) DropWhere(fn func(string, interface{}) bool) StringAnyTuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map.
func (StringAnyMap) Exists ¶
func (mm StringAnyMap) Exists(fn func(string, interface{}) bool) bool
Exists applies a predicate function to every element in the map. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (StringAnyMap) Filter ¶
func (mm StringAnyMap) Filter(fn func(string, interface{}) bool) StringAnyMap
Filter applies a predicate function to every element in the map and returns a copied map containing only the elements for which the predicate returned true. The original map is not modified
func (StringAnyMap) Find ¶
func (mm StringAnyMap) Find(fn func(string, interface{}) bool) (StringAnyTuple, bool)
Find returns the first interface{} that returns true for some function. False is returned if none match. The original map is not modified
func (StringAnyMap) FlatMap ¶
func (mm StringAnyMap) FlatMap(fn func(string, interface{}) []StringAnyTuple) StringAnyMap
FlatMap returns a new AnyMap by transforming every element with a function fn that returns zero or more items in a slice. The resulting map may have a different size to the original map. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringAnyMap) Forall ¶
func (mm StringAnyMap) Forall(fn func(string, interface{}) bool) bool
Forall applies a predicate function to every element in the map. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (StringAnyMap) Foreach ¶
func (mm StringAnyMap) Foreach(fn func(string, interface{}))
Foreach applies a function to every element in the map. The function can safely alter the values via side-effects.
func (StringAnyMap) Get ¶
func (mm StringAnyMap) Get(k string) (interface{}, bool)
Get returns one of the items in the map, if present.
func (StringAnyMap) IsEmpty ¶
func (mm StringAnyMap) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (StringAnyMap) Keys ¶
func (mm StringAnyMap) Keys() []string
Keys returns the keys of the current map as a slice.
func (StringAnyMap) Map ¶
func (mm StringAnyMap) Map(fn func(string, interface{}) (string, interface{})) StringAnyMap
Map returns a new AnyMap by transforming every element with a function fn. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringAnyMap) NonEmpty ¶
func (mm StringAnyMap) NonEmpty() bool
NonEmpty returns true if the map is not empty.
func (StringAnyMap) Partition ¶
func (mm StringAnyMap) Partition(fn func(string, interface{}) bool) (matching StringAnyMap, others StringAnyMap)
Partition applies a predicate function to every element in the map. It divides the map into two copied maps, the first containing all the elements for which the predicate returned true, and the second containing all the others. The original map is not modified
func (StringAnyMap) Pop ¶
func (mm StringAnyMap) Pop(k string) (interface{}, bool)
Pop removes a single item from the map, returning the value present until removal.
func (StringAnyMap) Put ¶
func (mm StringAnyMap) Put(k string, v interface{}) bool
Put adds an item to the current map, replacing interface{} prior value.
func (StringAnyMap) Remove ¶
func (mm StringAnyMap) Remove(k string)
Remove a single item from the map.
func (StringAnyMap) Size ¶
func (mm StringAnyMap) Size() int
Size returns how minterface{} items are currently in the map. This is a synonym for Len.
func (StringAnyMap) ToSlice ¶
func (mm StringAnyMap) ToSlice() []StringAnyTuple
ToSlice returns the key/value pairs as a slice
func (StringAnyMap) Values ¶
func (mm StringAnyMap) Values() []interface{}
Values returns the values of the current map as a slice.
type StringAnyTuple ¶
type StringAnyTuple struct { Key string Val interface{} }
StringAnyTuple represents a key/value pair.
type StringAnyTuples ¶
type StringAnyTuples []StringAnyTuple
StringAnyTuples can be used as a builder for unmodifiable maps.
func (StringAnyTuples) Append1 ¶
func (ts StringAnyTuples) Append1(k string, v interface{}) StringAnyTuples
func (StringAnyTuples) Append2 ¶
func (ts StringAnyTuples) Append2(k1 string, v1 interface{}, k2 string, v2 interface{}) StringAnyTuples
func (StringAnyTuples) Append3 ¶
func (ts StringAnyTuples) Append3(k1 string, v1 interface{}, k2 string, v2 interface{}, k3 string, v3 interface{}) StringAnyTuples
type StringList ¶
type StringList []string
StringList is a slice of type string. Use it where you would use []string. To add items to the list, simply use the normal built-in append function. List values follow a similar pattern to Scala Lists and LinearSeqs in particular. Importantly, *none of its methods ever mutate a list*; they merely return new lists where required. When a list needs mutating, use normal Go slice operations, e.g. *append()*. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq
func BuildStringListFromChan ¶
func BuildStringListFromChan(source <-chan string) StringList
BuildStringListFromChan constructs a new StringList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertStringList ¶
func ConvertStringList(values ...interface{}) (StringList, bool)
ConvertStringList constructs a new list containing the supplied values, if any. The returned boolean will be false if any of the values could not be converted correctly. The returned list will contain all the values that were correctly converted.
func NewStringList ¶
func NewStringList(values ...string) StringList
NewStringList constructs a new list containing the supplied values, if any.
func (StringList) Clone ¶
func (list StringList) Clone() StringList
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (StringList) Contains ¶
func (list StringList) Contains(v string) bool
Contains determines if a given item is already in the list.
func (StringList) ContainsAll ¶
func (list StringList) ContainsAll(i ...string) bool
ContainsAll determines if the given items are all in the list. This is potentially a slow method and should only be used rarely.
func (StringList) CountBy ¶
func (list StringList) CountBy(predicate func(string) bool) (result int)
CountBy gives the number elements of StringList that return true for the passed predicate.
func (StringList) DistinctBy ¶
func (list StringList) DistinctBy(equal func(string, string) bool) StringList
DistinctBy returns a new StringList whose elements are unique, where equality is defined by a passed func.
func (StringList) Drop ¶
func (list StringList) Drop(n int) StringList
Drop returns a slice of StringList without the leading n elements of the source list. If n is greater than or equal to the size of the list, an empty list is returned.
func (StringList) DropLast ¶
func (list StringList) DropLast(n int) StringList
DropLast returns a slice of StringList without the trailing n elements of the source list. If n is greater than or equal to the size of the list, an empty list is returned.
func (StringList) DropWhile ¶
func (list StringList) DropWhile(p func(string) bool) StringList
DropWhile returns a new StringList containing the trailing elements of the source list. Whilst the predicate p returns true, elements are excluded from the result. Once predicate p returns false, all remaining elemense are added.
func (StringList) Equals ¶
func (list StringList) Equals(other StringList) bool
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal.
func (StringList) Exists ¶
func (list StringList) Exists(fn func(string) bool) bool
Exists verifies that one or more elements of StringList return true for the passed func.
func (StringList) Filter ¶
func (list StringList) Filter(fn func(string) bool) StringList
Filter returns a new StringList whose elements return true for func. The original list is not modified
func (StringList) Find ¶
func (list StringList) Find(fn func(string) bool) (string, bool)
Find returns the first string that returns true for some function. False is returned if none match.
func (StringList) FlatMap ¶
func (list StringList) FlatMap(fn func(string) []string) StringList
FlatMap returns a new StringList by transforming every element with a function fn that returns zero or more items in a slice. The resulting list may have a different size to the original list. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringList) Forall ¶
func (list StringList) Forall(fn func(string) bool) bool
Forall verifies that all elements of StringList return true for the passed func.
func (StringList) Foreach ¶
func (list StringList) Foreach(fn func(string))
Foreach iterates over StringList and executes the passed func against each element.
func (StringList) Get ¶
func (list StringList) Get(i int) string
Get gets the specified element in the list. Panics if the index is out of range. The simple list is a dressed-up slice and normal slice operations will also work.
func (StringList) Head ¶
func (list StringList) Head() string
Head gets the first element in the list. Head plus Tail include the whole list. Head is the opposite of Last. Panics if list is empty
func (StringList) IndexWhere ¶
func (list StringList) IndexWhere(p func(string) bool) int
IndexWhere finds the index of the first element satisfying some predicate. If none exists, -1 is returned.
func (StringList) IndexWhere2 ¶
func (list StringList) IndexWhere2(p func(string) bool, from int) int
IndexWhere2 finds the index of the first element satisfying some predicate at or after some start index. If none exists, -1 is returned.
func (StringList) Init ¶
func (list StringList) Init() StringList
Init gets everything except the last. Init plus Last include the whole list. Init is the opposite of Tail. Panics if list is empty
func (StringList) IsEmpty ¶
func (list StringList) IsEmpty() bool
IsEmpty tests whether StringList is empty.
func (StringList) IsSequence ¶
func (list StringList) IsSequence() bool
IsSequence returns true for lists.
func (StringList) Last ¶
func (list StringList) Last() string
Last gets the last element in the list. Init plus Last include the whole list. Last is the opposite of Head. Panics if list is empty
func (StringList) LastIndexWhere ¶
func (list StringList) LastIndexWhere(p func(string) bool) int
LastIndexWhere finds the index of the last element satisfying some predicate. If none exists, -1 is returned.
func (StringList) LastIndexWhere2 ¶
func (list StringList) LastIndexWhere2(p func(string) bool, before int) int
LastIndexWhere2 finds the index of the last element satisfying some predicate at or before some start index. If none exists, -1 is returned.
func (StringList) Len ¶
func (list StringList) Len() int
Len returns the number of items in the list - an alias of Size(). This is one of the three methods in the standard sort.Interface.
func (StringList) Map ¶
func (list StringList) Map(fn func(string) string) StringList
Map returns a new StringList by transforming every element with a function fn. The resulting list is the same size as the original list. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringList) Max ¶
func (list StringList) Max() (result string)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (StringList) MaxBy ¶
func (list StringList) MaxBy(less func(string, string) bool) string
MaxBy returns an element of StringList containing the maximum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally maximal, the first such element is returned. Panics if there are no elements.
func (StringList) Min ¶
func (list StringList) Min() string
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (StringList) MinBy ¶
func (list StringList) MinBy(less func(string, string) bool) string
MinBy returns an element of StringList containing the minimum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally minimal, the first such element is returned. Panics if there are no elements.
func (StringList) NonEmpty ¶
func (list StringList) NonEmpty() bool
NonEmpty tests whether StringList is empty.
func (StringList) Partition ¶
func (list StringList) Partition(p func(string) bool) (StringList, StringList)
Partition returns two new stringLists whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list. The original list is not modified
func (StringList) Reverse ¶
func (list StringList) Reverse() StringList
Reverse returns a copy of StringList with all elements in the reverse order.
func (StringList) Send ¶
func (list StringList) Send() <-chan string
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed
func (StringList) Shuffle ¶
func (list StringList) Shuffle() StringList
Shuffle returns a shuffled copy of StringList, using a version of the Fisher-Yates shuffle.
func (StringList) Size ¶
func (list StringList) Size() int
Size returns the number of items in the list - an alias of Len().
func (StringList) SortBy ¶
func (list StringList) SortBy(less func(i, j string) bool) StringList
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (StringList) Sorted ¶
func (list StringList) Sorted() StringList
Sorted alters the list so that the elements are sorted by their natural ordering.
func (StringList) StableSortBy ¶
func (list StringList) StableSortBy(less func(i, j string) bool) StringList
StableSortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned. The algorithm keeps the original order of equal elements.
func (StringList) StableSorted ¶
func (list StringList) StableSorted() StringList
StableSorted alters the list so that the elements are sorted by their natural ordering.
func (StringList) Swap ¶
func (list StringList) Swap(i, j int)
Swap exchanges two elements, which is necessary during sorting etc. This is one of the three methods in the standard sort.Interface.
func (StringList) Tail ¶
func (list StringList) Tail() StringList
Tail gets everything except the head. Head plus Tail include the whole list. Tail is the opposite of Init. Panics if list is empty
func (StringList) Take ¶
func (list StringList) Take(n int) StringList
Take returns a slice of StringList containing the leading n elements of the source list. If n is greater than the size of the list, the whole original list is returned.
func (StringList) TakeLast ¶
func (list StringList) TakeLast(n int) StringList
TakeLast returns a slice of StringList containing the trailing n elements of the source list. If n is greater than the size of the list, the whole original list is returned.
func (StringList) TakeWhile ¶
func (list StringList) TakeWhile(p func(string) bool) StringList
TakeWhile returns a new StringList containing the leading elements of the source list. Whilst the predicate p returns true, elements are added to the result. Once predicate p returns false, all remaining elemense are excluded.
func (StringList) ToInterfaceSlice ¶
func (list StringList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
type StringSet ¶
type StringSet map[string]struct{}
StringSet is the primary type that represents a set
func BuildStringSetFromChan ¶
BuildStringSetFromChan constructs a new StringSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertStringSet ¶
ConvertStringSet constructs a new set containing the supplied values, if any. The returned boolean will be false if any of the values could not be converted correctly.
func NewStringSet ¶
NewStringSet creates and returns a reference to an empty set.
func (StringSet) Cardinality ¶
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*StringSet) Clear ¶
func (set *StringSet) Clear()
Clear clears the entire set to be the empty set.
func (StringSet) Clone ¶
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (StringSet) ContainsAll ¶
ContainsAll determines if the given items are all in the set
func (StringSet) CountBy ¶
CountBy gives the number elements of StringSet that return true for the passed predicate.
func (StringSet) Difference ¶
Difference returns a new set with items in the current set but not in the other set
func (StringSet) Equals ¶
Equals determines if two sets are equal to each other. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal.
func (StringSet) Exists ¶
Exists applies a predicate function to every element in the set. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (StringSet) Filter ¶
Filter returns a new StringSet whose elements return true for func. The original set is not modified
func (StringSet) FlatMap ¶
FlatMap returns a new StringSet by transforming every element with a function fn that returns zero or more items in a slice. The resulting list may have a different size to the original list. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringSet) Forall ¶
Forall applies a predicate function to every element in the set. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (StringSet) Foreach ¶
Foreach iterates over stringSet and executes the passed func against each element.
func (StringSet) IsSequence ¶
IsSequence returns true for lists.
func (StringSet) IsSuperset ¶
IsSuperset determines if every item of this set is in the other set.
func (StringSet) Map ¶
Map returns a new StringSet by transforming every element with a function fn. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringSet) Max ¶
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (StringSet) MaxBy ¶
MaxBy returns an element of StringSet containing the maximum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally maximal, the first such element is returned. Panics if there are no elements.
func (StringSet) Min ¶
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (StringSet) MinBy ¶
MinBy returns an element of StringSet containing the minimum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally minimal, the first such element is returned. Panics if there are no elements.
func (StringSet) Partition ¶
Partition returns two new stringSets whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list. The original set is not modified
func (StringSet) Send ¶
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed
func (StringSet) Size ¶
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (StringSet) SymmetricDifference ¶
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (StringSet) ToInterfaceSlice ¶
func (set StringSet) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.