immutable

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

package immutable provides immutable collection types for core Go built-in types. These are safe for sharing across multiple goroutines because they are immutable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyCollection added in v0.4.0

type AnyCollection interface {
	AnySizer
	AnyMkStringer

	// IsSequence returns true for lists and queues.
	IsSequence() bool

	// IsSet returns false for lists and queues.
	IsSet() bool

	// ToSlice returns a shallow copy as a plain slice.
	ToSlice() []interface{}

	// ToInterfaceSlice returns a shallow copy as a slice of arbitrary type.
	ToInterfaceSlice() []interface{}

	// Exists verifies that one or more elements of AnyCollection return true for the predicate p.
	Exists(p func(interface{}) bool) bool

	// Forall verifies that all elements of AnyCollection return true for the predicate p.
	Forall(p func(interface{}) bool) bool

	// Foreach iterates over AnyCollection and executes the function f against each element.
	Foreach(f func(interface{}))

	// Find returns the first interface{} that returns true for the predicate p.
	// False is returned if none match.
	Find(p func(interface{}) bool) (interface{}, bool)

	// Send returns a channel that will send all the elements in order. Can be used with the plumbing code, for example.
	// A goroutine is created to send the elements; this only terminates when all the elements have been consumed
	Send() <-chan interface{}

	// CountBy gives the number elements of AnyCollection that return true for the predicate p.
	CountBy(p func(interface{}) bool) int

	// Contains determines whether a given item is already in the collection, returning true if so.
	Contains(v interface{}) bool

	// ContainsAll determines whether the given items are all in the collection, returning true if so.
	ContainsAll(v ...interface{}) bool

	// MinBy returns an element of AnyCollection 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.
	MinBy(less func(interface{}, interface{}) bool) interface{}

	// MaxBy returns an element of AnyCollection 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.
	MaxBy(less func(interface{}, interface{}) bool) interface{}

	// Fold aggregates all the values in the collection using a supplied function, starting from some initial value.
	Fold(initial interface{}, fn func(interface{}, interface{}) interface{}) interface{}
}

AnyCollection defines an interface for common collection methods on interface{}.

type AnyList added in v0.4.0

type AnyList struct {
	// contains filtered or unexported fields
}

AnyList contains a slice of type interface{}. It is designed to be immutable - ideal for race-free reference lists etc. It encapsulates the slice and provides methods to access it. Importantly, *none of its methods ever mutate a list*; they merely return new lists where required.

List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq

func BuildAnyListFromChan added in v0.4.0

func BuildAnyListFromChan(source <-chan interface{}) *AnyList

BuildAnyListFromChan constructs a new AnyList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.

func ConvertAnyList added in v0.4.0

func ConvertAnyList(values ...interface{}) (*AnyList, bool)

ConvertAnyList 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 NewAnyList added in v0.4.0

func NewAnyList(values ...interface{}) *AnyList

NewAnyList constructs a new list containing the supplied values, if any.

func (*AnyList) Append added in v0.4.0

func (list *AnyList) Append(more ...interface{}) *AnyList

Append returns a new list with all original items and all in `more`; they retain their order. The original list is not altered.

func (*AnyList) Clone added in v0.4.0

func (list *AnyList) Clone() *AnyList

Clone returns the same list, which is immutable.

func (*AnyList) Contains added in v0.6.0

func (list *AnyList) Contains(v interface{}) bool

Contains determines whether a given item is already in the list, returning true if so.

func (*AnyList) ContainsAll added in v0.6.0

func (list *AnyList) ContainsAll(i ...interface{}) bool

ContainsAll determines whether the given items are all in the list, returning true if so. This is potentially a slow method and should only be used rarely.

func (*AnyList) CountBy added in v0.4.0

func (list *AnyList) CountBy(p func(interface{}) bool) (result int)

CountBy gives the number elements of AnyList that return true for the predicate p.

func (*AnyList) DistinctBy added in v0.4.0

func (list *AnyList) DistinctBy(equal func(interface{}, interface{}) bool) *AnyList

DistinctBy returns a new AnyList whose elements are unique, where equality is defined by the equal function.

func (*AnyList) Drop added in v0.4.0

func (list *AnyList) Drop(n int) *AnyList

Drop returns a slice of AnyList 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 (*AnyList) DropLast added in v0.4.0

func (list *AnyList) DropLast(n int) *AnyList

DropLast returns a slice of AnyList 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 (*AnyList) DropWhile added in v0.4.0

func (list *AnyList) DropWhile(p func(interface{}) bool) *AnyList

DropWhile returns a new AnyList 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 elements are added.

func (*AnyList) Equals added in v0.6.0

func (list *AnyList) Equals(other *AnyList) 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. Nil lists are considered to be empty.

func (*AnyList) Exists added in v0.4.0

func (list *AnyList) Exists(p func(interface{}) bool) bool

Exists verifies that one or more elements of AnyList return true for the predicate p.

func (*AnyList) Filter added in v0.4.0

func (list *AnyList) Filter(p func(interface{}) bool) *AnyList

Filter returns a new AnyList whose elements return true for predicate p.

func (*AnyList) Find added in v0.4.0

func (list *AnyList) Find(p func(interface{}) bool) (interface{}, bool)

Find returns the first interface{} that returns true for predicate p. False is returned if none match.

func (*AnyList) FlatMap added in v0.4.0

func (list *AnyList) FlatMap(f func(interface{}) []interface{}) *AnyList

FlatMap returns a new AnyList by transforming every element with function f that returns zero or more items in a slice. The resulting list may have a different size to the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*AnyList) Fold added in v0.9.0

func (list *AnyList) Fold(initial interface{}, fn func(interface{}, interface{}) interface{}) interface{}

Fold aggregates all the values in the list using a supplied function, starting from some initial value.

func (*AnyList) Forall added in v0.4.0

func (list *AnyList) Forall(p func(interface{}) bool) bool

Forall verifies that all elements of AnyList return true for the predicate p.

func (*AnyList) Foreach added in v0.4.0

func (list *AnyList) Foreach(f func(interface{}))

Foreach iterates over AnyList and executes function f against each element. The function receives copies that do not alter the list elements when they are changed.

func (*AnyList) Get added in v0.4.0

func (list *AnyList) Get(i int) interface{}

Get gets the specified element in the list. Panics if the index is out of range or the list is nil.

func (*AnyList) GobDecode added in v0.6.0

func (list *AnyList) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this list type. You must register interface{} with the 'gob' package before this method is used.

func (AnyList) GobEncode added in v0.6.0

func (list AnyList) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register interface{} with the 'gob' package before this method is used.

func (*AnyList) Head added in v0.4.0

func (list *AnyList) Head() interface{}

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 or nil.

func (*AnyList) HeadOption added in v0.4.0

func (list *AnyList) HeadOption() (interface{}, bool)

HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.

func (*AnyList) IndexWhere added in v0.4.0

func (list *AnyList) IndexWhere(p func(interface{}) bool) int

IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.

func (*AnyList) IndexWhere2 added in v0.4.0

func (list *AnyList) IndexWhere2(p func(interface{}) bool, from int) int

IndexWhere2 finds the index of the first element satisfying predicate p at or after some start index. If none exists, -1 is returned.

func (*AnyList) Init added in v0.4.0

func (list *AnyList) Init() *AnyList

Init gets everything except the last. Init plus Last include the whole list. Init is the opposite of Tail. Panics if list is empty or nil.

func (*AnyList) IsEmpty added in v0.4.0

func (list *AnyList) IsEmpty() bool

IsEmpty tests whether AnyList is empty.

func (*AnyList) IsSequence added in v0.4.0

func (list *AnyList) IsSequence() bool

IsSequence returns true for lists and queues.

func (*AnyList) IsSet added in v0.4.0

func (list *AnyList) IsSet() bool

IsSet returns false for lists or queues.

func (*AnyList) Last added in v0.4.0

func (list *AnyList) Last() interface{}

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 or nil.

func (*AnyList) LastIndexWhere added in v0.4.0

func (list *AnyList) LastIndexWhere(p func(interface{}) bool) int

LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.

func (*AnyList) LastIndexWhere2 added in v0.4.0

func (list *AnyList) LastIndexWhere2(p func(interface{}) bool, before int) int

LastIndexWhere2 finds the index of the last element satisfying predicate p at or before some start index. If none exists, -1 is returned.

func (*AnyList) LastOption added in v0.4.0

func (list *AnyList) LastOption() (interface{}, bool)

LastOption gets the last element in the list, if possible. Otherwise returns the zero value.

func (*AnyList) Len added in v0.4.0

func (list *AnyList) Len() int

Len returns the number of items in the list - an alias of Size().

func (*AnyList) Map added in v0.4.0

func (list *AnyList) Map(f func(interface{}) interface{}) *AnyList

Map returns a new AnyList by transforming every element with function f. The resulting list is the same size as the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (AnyList) MarshalJSON added in v0.6.0

func (list AnyList) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this list type.

func (*AnyList) MaxBy added in v0.4.0

func (list *AnyList) MaxBy(less func(interface{}, interface{}) bool) interface{}

MaxBy returns an element of AnyList 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 (*AnyList) MinBy added in v0.4.0

func (list *AnyList) MinBy(less func(interface{}, interface{}) bool) interface{}

MinBy returns an element of AnyList 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 (*AnyList) MkString added in v0.6.0

func (list *AnyList) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*AnyList) MkString3 added in v0.6.0

func (list *AnyList) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*AnyList) NonEmpty added in v0.4.0

func (list *AnyList) NonEmpty() bool

NonEmpty tests whether AnyList is empty.

func (*AnyList) Partition added in v0.4.0

func (list *AnyList) Partition(p func(interface{}) bool) (*AnyList, *AnyList)

Partition returns two new interface{}Lists 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.

func (*AnyList) Reverse added in v0.4.0

func (list *AnyList) Reverse() *AnyList

Reverse returns a copy of AnyList with all elements in the reverse order.

func (*AnyList) Send added in v0.4.0

func (list *AnyList) Send() <-chan interface{}

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. The channel will be closed when all the elements have been sent.

func (*AnyList) Shuffle added in v0.4.0

func (list *AnyList) Shuffle() *AnyList

Shuffle returns a shuffled copy of AnyList, using a version of the Fisher-Yates shuffle.

func (*AnyList) Size added in v0.4.0

func (list *AnyList) Size() int

Size returns the number of items in the list - an alias of Len().

func (*AnyList) SortBy added in v0.4.0

func (list *AnyList) SortBy(less func(i, j interface{}) bool) *AnyList

SortBy returns a new list in which the elements are sorted by a specified ordering.

func (*AnyList) StableSortBy added in v0.4.0

func (list *AnyList) StableSortBy(less func(i, j interface{}) bool) *AnyList

StableSortBy returns a new list in which the elements are sorted by a specified ordering. The algorithm keeps the original order of equal elements.

func (*AnyList) String added in v0.6.0

func (list *AnyList) String() string

String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.

func (*AnyList) StringList added in v0.6.0

func (list *AnyList) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*AnyList) Tail added in v0.4.0

func (list *AnyList) Tail() *AnyList

Tail gets everything except the head. Head plus Tail include the whole list. Tail is the opposite of Init. Panics if list is empty or nil.

func (*AnyList) Take added in v0.4.0

func (list *AnyList) Take(n int) *AnyList

Take returns a slice of AnyList containing the leading n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.

func (*AnyList) TakeLast added in v0.4.0

func (list *AnyList) TakeLast(n int) *AnyList

TakeLast returns a slice of AnyList containing the trailing n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.

func (*AnyList) TakeWhile added in v0.4.0

func (list *AnyList) TakeWhile(p func(interface{}) bool) *AnyList

TakeWhile returns a new AnyList 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 elements are excluded.

func (*AnyList) ToInterfaceSlice added in v0.4.0

func (list *AnyList) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.

func (*AnyList) ToList added in v0.4.0

func (list *AnyList) ToList() *AnyList

ToList returns the elements of the list as a list, which is an identity operation in this case.

func (*AnyList) ToSet added in v0.4.0

func (list *AnyList) ToSet() *AnySet

ToSet returns the elements of the list as a set. The returned set is a shallow copy; the list is not altered.

func (*AnyList) ToSlice added in v0.4.0

func (list *AnyList) ToSlice() []interface{}

ToSlice returns the elements of the current list as a slice.

func (*AnyList) UnmarshalJSON added in v0.6.0

func (list *AnyList) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this list type.

type AnyMkStringer added in v0.6.0

type AnyMkStringer interface {
	// String implements the Stringer interface to render the list as a comma-separated string enclosed
	// in square brackets.
	String() string

	// MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
	MkString(sep string) string

	// MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
	MkString3(before, between, after string) string

	// implements json.Marshaler interface {
	MarshalJSON() ([]byte, error)

	// StringList gets a slice of strings that depicts all the elements.
	StringList() []string
}

AnyMkStringer defines an interface for stringer methods on interface{} collections.

type AnySequence added in v0.9.0

type AnySequence interface {
	AnyCollection

	// Head gets the first element in the sequence. Head plus Tail include the whole sequence. Head is the opposite of Last.
	Head() interface{}

	// HeadOption gets the first element in the sequence, if possible.
	HeadOption() (interface{}, bool)

	// Last gets the last element in the sequence. Init plus Last include the whole sequence. Last is the opposite of Head.
	Last() interface{}

	// LastOption gets the last element in the sequence, if possible.
	LastOption() (interface{}, bool)
}

AnySequence defines an interface for sequence methods on interface{}.

type AnySet added in v0.4.0

type AnySet struct {
	// contains filtered or unexported fields
}

AnySet is the primary type that represents a set.

func BuildAnySetFromChan added in v0.4.0

func BuildAnySetFromChan(source <-chan interface{}) *AnySet

BuildAnySetFromChan constructs a new AnySet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.

func ConvertAnySet added in v0.4.0

func ConvertAnySet(values ...interface{}) (*AnySet, bool)

ConvertAnySet 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. The returned set will contain all the values that were correctly converted.

func NewAnySet added in v0.4.0

func NewAnySet(values ...interface{}) *AnySet

NewAnySet creates and returns a reference to an empty set.

func (*AnySet) Add added in v0.4.0

func (set *AnySet) Add(more ...interface{}) *AnySet

Add returns a new set with all original items and all in `more`. The original set is not altered.

func (*AnySet) Cardinality added in v0.4.0

func (set *AnySet) Cardinality() int

Cardinality returns how many items are currently in the set. This is a synonym for Size.

func (*AnySet) Clone added in v0.4.0

func (set *AnySet) Clone() *AnySet

Clone returns the same set, which is immutable.

func (*AnySet) Contains added in v0.4.0

func (set *AnySet) Contains(i interface{}) bool

Contains determines whether a given item is already in the set, returning true if so.

func (*AnySet) ContainsAll added in v0.4.0

func (set *AnySet) ContainsAll(i ...interface{}) bool

ContainsAll determines whether a given item is already in the set, returning true if so.

func (*AnySet) CountBy added in v0.4.0

func (set *AnySet) CountBy(p func(interface{}) bool) (result int)

CountBy gives the number elements of AnySet that return true for the predicate p.

func (*AnySet) Difference added in v0.4.0

func (set *AnySet) Difference(other *AnySet) *AnySet

Difference returns a new set with items in the current set but not in the other set

func (*AnySet) Equals added in v0.4.0

func (set *AnySet) Equals(other *AnySet) bool

Equals determines whether two sets are equal to each other, returning true if so. 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 (*AnySet) Exists added in v0.4.0

func (set *AnySet) Exists(p func(interface{}) bool) bool

Exists applies a predicate p 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 (*AnySet) Filter added in v0.4.0

func (set *AnySet) Filter(p func(interface{}) bool) *AnySet

Filter returns a new AnySet whose elements return true for the predicate p.

func (*AnySet) Find added in v0.4.0

func (set *AnySet) Find(p func(interface{}) bool) (interface{}, bool)

Find returns the first interface{} that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.

func (*AnySet) FlatMap added in v0.4.0

func (set *AnySet) FlatMap(f func(interface{}) []interface{}) *AnySet

FlatMap returns a new AnySet by transforming every element with a function f that returns zero or more items in a slice. The resulting set may have a different size to the original set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*AnySet) Fold added in v0.9.0

func (set *AnySet) Fold(initial interface{}, fn func(interface{}, interface{}) interface{}) interface{}

Fold aggregates all the values in the set using a supplied function, starting from some initial value.

func (*AnySet) Forall added in v0.4.0

func (set *AnySet) Forall(p func(interface{}) bool) bool

Forall applies a predicate function p 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 (*AnySet) Foreach added in v0.4.0

func (set *AnySet) Foreach(f func(interface{}))

Foreach iterates over interface{}Set and executes the function f against each element.

func (*AnySet) GobDecode added in v0.6.0

func (set *AnySet) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this set type. You must register interface{} with the 'gob' package before this method is used.

func (AnySet) GobEncode added in v0.6.0

func (set AnySet) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register interface{} with the 'gob' package before this method is used.

func (*AnySet) Intersect added in v0.4.0

func (set *AnySet) Intersect(other *AnySet) *AnySet

Intersect returns a new set with items that exist only in both sets.

func (*AnySet) IsEmpty added in v0.4.0

func (set *AnySet) IsEmpty() bool

IsEmpty returns true if the set is empty.

func (*AnySet) IsSequence added in v0.4.0

func (set *AnySet) IsSequence() bool

IsSequence returns true for lists and queues.

func (*AnySet) IsSet added in v0.4.0

func (set *AnySet) IsSet() bool

IsSet returns false for lists or queues.

func (*AnySet) IsSubset added in v0.4.0

func (set *AnySet) IsSubset(other *AnySet) bool

IsSubset determines whether every item in the other set is in this set, returning true if so.

func (*AnySet) IsSuperset added in v0.4.0

func (set *AnySet) IsSuperset(other *AnySet) bool

IsSuperset determines whether every item of this set is in the other set, returning true if so.

func (*AnySet) Map added in v0.4.0

func (set *AnySet) Map(f func(interface{}) interface{}) *AnySet

Map returns a new AnySet by transforming every element with a function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*AnySet) MarshalJSON added in v0.6.0

func (set *AnySet) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this set type.

func (*AnySet) MaxBy added in v0.4.0

func (set *AnySet) MaxBy(less func(interface{}, interface{}) bool) interface{}

MaxBy returns an element of AnySet 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 (*AnySet) MinBy added in v0.4.0

func (set *AnySet) MinBy(less func(interface{}, interface{}) bool) interface{}

MinBy returns an element of AnySet 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 (*AnySet) MkString added in v0.6.0

func (set *AnySet) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*AnySet) MkString3 added in v0.6.0

func (set *AnySet) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*AnySet) NonEmpty added in v0.4.0

func (set *AnySet) NonEmpty() bool

NonEmpty returns true if the set is not empty.

func (*AnySet) Partition added in v0.4.0

func (set *AnySet) Partition(p func(interface{}) bool) (*AnySet, *AnySet)

Partition returns two new interface{}Sets 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.

func (*AnySet) Remove added in v0.4.0

func (set *AnySet) Remove(i interface{}) *AnySet

Remove removes a single item from the set. A new set is returned that has all the elements except the removed one.

func (*AnySet) Send added in v0.4.0

func (set *AnySet) Send() <-chan interface{}

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 (*AnySet) Size added in v0.4.0

func (set *AnySet) Size() int

Size returns how many items are currently in the set. This is a synonym for Cardinality.

func (*AnySet) String added in v0.6.0

func (set *AnySet) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*AnySet) StringList added in v0.6.0

func (set *AnySet) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*AnySet) StringMap added in v0.6.0

func (set *AnySet) StringMap() map[string]bool

StringMap renders the set as a map of strings. The value of each item in the set becomes stringified as a key in the resulting map.

func (*AnySet) SymmetricDifference added in v0.4.0

func (set *AnySet) SymmetricDifference(other *AnySet) *AnySet

SymmetricDifference returns a new set with items in the current set or the other set but not in both.

func (*AnySet) ToInterfaceSlice added in v0.4.0

func (set *AnySet) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.

func (*AnySet) ToList added in v0.4.0

func (set *AnySet) ToList() *AnyList

ToList returns the elements of the set as a list. The returned list is a shallow copy; the set is not altered.

func (*AnySet) ToSet added in v0.4.0

func (set *AnySet) ToSet() *AnySet

ToSet returns the set; this is an identity operation in this case.

func (*AnySet) ToSlice added in v0.4.0

func (set *AnySet) ToSlice() []interface{}

ToSlice returns the elements of the current set as a slice.

func (*AnySet) Union added in v0.4.0

func (set *AnySet) Union(other *AnySet) *AnySet

Union returns a new set with all items in both sets.

func (*AnySet) UnmarshalJSON added in v0.6.0

func (set *AnySet) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this set type.

type AnySizer added in v0.4.0

type AnySizer interface {
	// IsEmpty tests whether AnyCollection is empty.
	IsEmpty() bool

	// NonEmpty tests whether AnyCollection is empty.
	NonEmpty() bool

	// Size returns the number of items in the list - an alias of Len().
	Size() int
}

AnySizer defines an interface for sizing methods on interface{} collections.

type Int64Collection added in v0.3.0

type Int64Collection interface {
	Int64Sizer
	Int64MkStringer

	// IsSequence returns true for lists and queues.
	IsSequence() bool

	// IsSet returns false for lists and queues.
	IsSet() bool

	// ToSlice returns a shallow copy as a plain slice.
	ToSlice() []int64

	// ToInterfaceSlice returns a shallow copy as a slice of arbitrary type.
	ToInterfaceSlice() []interface{}

	// Exists verifies that one or more elements of Int64Collection return true for the predicate p.
	Exists(p func(int64) bool) bool

	// Forall verifies that all elements of Int64Collection return true for the predicate p.
	Forall(p func(int64) bool) bool

	// Foreach iterates over Int64Collection and executes the function f against each element.
	Foreach(f func(int64))

	// Find returns the first int64 that returns true for the predicate p.
	// False is returned if none match.
	Find(p func(int64) bool) (int64, bool)

	// MapToString returns a new []string by transforming every element with function f.
	// The resulting slice is the same size as the collection. The collection is not modified.
	MapToString(f func(int64) string) []string

	// FlatMapString returns a new []string by transforming every element with function f
	// that returns zero or more items in a slice. The resulting slice may have a different size to the
	// collection. The collection is not modified.
	FlatMapToString(f func(int64) []string) []string

	// Send returns a channel that will send all the elements in order. Can be used with the plumbing code, for example.
	// A goroutine is created to send the elements; this only terminates when all the elements have been consumed
	Send() <-chan int64

	// CountBy gives the number elements of Int64Collection that return true for the predicate p.
	CountBy(p func(int64) bool) int

	// Contains determines whether a given item is already in the collection, returning true if so.
	Contains(v int64) bool

	// ContainsAll determines whether the given items are all in the collection, returning true if so.
	ContainsAll(v ...int64) bool

	// Min returns the minimum value of all the items in the collection. Panics if there are no elements.
	Min() int64

	// Max returns the minimum value of all the items in the collection. Panics if there are no elements.
	Max() int64

	// MinBy returns an element of Int64Collection 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.
	MinBy(less func(int64, int64) bool) int64

	// MaxBy returns an element of Int64Collection 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.
	MaxBy(less func(int64, int64) bool) int64

	// Fold aggregates all the values in the collection using a supplied function, starting from some initial value.
	Fold(initial int64, fn func(int64, int64) int64) int64

	// Sum returns the sum of all the elements in the collection.
	Sum() int64
}

Int64Collection defines an interface for common collection methods on int64.

type Int64Int64Map added in v0.3.0

type Int64Int64Map struct {
	// contains filtered or unexported fields
}

Int64Int64Map is the primary type that represents a thread-safe map

func NewInt64Int64Map added in v0.3.0

func NewInt64Int64Map(kv ...Int64Int64Tuple) *Int64Int64Map

NewInt64Int64Map creates and returns a reference to a map, optionally containing some items.

func NewInt64Int64Map1 added in v0.3.0

func NewInt64Int64Map1(k int64, v int64) *Int64Int64Map

NewInt64Int64Map1 creates and returns a reference to a map containing one item.

func (*Int64Int64Map) Clone added in v0.3.0

func (mm *Int64Int64Map) Clone() *Int64Int64Map

Clone returns the same map, which is immutable.

func (*Int64Int64Map) ContainsAllKeys added in v0.3.0

func (mm *Int64Int64Map) ContainsAllKeys(kk ...int64) bool

ContainsAllKeys determines if the given items are all in the map.

func (*Int64Int64Map) ContainsKey added in v0.3.0

func (mm *Int64Int64Map) ContainsKey(k int64) bool

ContainsKey determines if a given item is already in the map.

func (*Int64Int64Map) Equals added in v0.3.0

func (mm *Int64Int64Map) Equals(other *Int64Int64Map) bool

Equals determines if two maps 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 maps to be equal.

func (*Int64Int64Map) Exists added in v0.3.0

func (mm *Int64Int64Map) Exists(p func(int64, int64) bool) bool

Exists applies the predicate p 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 (*Int64Int64Map) Filter added in v0.3.0

func (mm *Int64Int64Map) Filter(p func(int64, int64) bool) *Int64Int64Map

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*Int64Int64Map) Find added in v0.3.0

func (mm *Int64Int64Map) Find(p func(int64, int64) bool) (Int64Int64Tuple, bool)

Find returns the first int64 that returns true for the predicate p. False is returned if none match.

func (*Int64Int64Map) FlatMap added in v0.3.0

func (mm *Int64Int64Map) FlatMap(f func(int64, int64) []Int64Int64Tuple) *Int64Int64Map

FlatMap returns a new Int64Map by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Int64Int64Map) Forall added in v0.3.0

func (mm *Int64Int64Map) Forall(f func(int64, int64) bool) bool

Forall applies the predicate p 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 (*Int64Int64Map) Foreach added in v0.3.0

func (mm *Int64Int64Map) Foreach(f func(int64, int64))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*Int64Int64Map) Get added in v0.3.0

func (mm *Int64Int64Map) Get(k int64) (int64, bool)

Get returns one of the items in the map, if present.

func (*Int64Int64Map) GobDecode added in v0.3.0

func (mm *Int64Int64Map) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register int64 with the 'gob' package before this method is used.

func (*Int64Int64Map) GobEncode added in v0.3.0

func (mm *Int64Int64Map) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register int64 with the 'gob' package before this method is used.

func (*Int64Int64Map) IsEmpty added in v0.3.0

func (mm *Int64Int64Map) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*Int64Int64Map) Keys added in v0.3.0

func (mm *Int64Int64Map) Keys() collection.Int64List

Keys returns the keys of the current map as a slice.

func (*Int64Int64Map) Map added in v0.3.0

func (mm *Int64Int64Map) Map(f func(int64, int64) (int64, int64)) *Int64Int64Map

Map returns a new Int64Map by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Int64Int64Map) MkString added in v0.3.0

func (mm *Int64Int64Map) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*Int64Int64Map) MkString4 added in v0.7.0

func (mm *Int64Int64Map) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*Int64Int64Map) NonEmpty added in v0.3.0

func (mm *Int64Int64Map) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*Int64Int64Map) OrderedSlice added in v0.6.0

func (mm *Int64Int64Map) OrderedSlice(keys collection.Int64List) Int64Int64Tuples

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*Int64Int64Map) Partition added in v0.3.0

func (mm *Int64Int64Map) Partition(p func(int64, int64) bool) (matching *Int64Int64Map, others *Int64Int64Map)

Partition applies the predicate p 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.

func (*Int64Int64Map) Put added in v0.3.0

func (mm *Int64Int64Map) Put(k int64, v int64) *Int64Int64Map

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*Int64Int64Map) Size added in v0.3.0

func (mm *Int64Int64Map) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*Int64Int64Map) String added in v0.3.0

func (mm *Int64Int64Map) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*Int64Int64Map) ToSlice added in v0.3.0

func (mm *Int64Int64Map) ToSlice() Int64Int64Tuples

ToSlice returns the key/value pairs as a slice

func (*Int64Int64Map) Values added in v0.3.0

func (mm *Int64Int64Map) Values() collection.Int64List

Values returns the values of the current map as a slice.

type Int64Int64Tuple added in v0.3.0

type Int64Int64Tuple struct {
	Key int64
	Val int64
}

Int64Int64Tuple represents a key/value pair.

func (Int64Int64Tuple) MarshalJSON added in v0.6.0

func (t Int64Int64Tuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (Int64Int64Tuple) UnmarshalJSON added in v0.6.0

func (t Int64Int64Tuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type Int64Int64Tuples added in v0.3.0

type Int64Int64Tuples []Int64Int64Tuple

Int64Int64Tuples can be used as a builder for unmodifiable maps.

func Int64Int64Zip added in v0.3.0

func Int64Int64Zip(keys ...int64) Int64Int64Tuples

Int64Int64Zip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewInt64Int64Map constructor function.

func (Int64Int64Tuples) Append1 added in v0.3.0

func (ts Int64Int64Tuples) Append1(k int64, v int64) Int64Int64Tuples

Append1 adds one item.

func (Int64Int64Tuples) Append2 added in v0.3.0

func (ts Int64Int64Tuples) Append2(k1 int64, v1 int64, k2 int64, v2 int64) Int64Int64Tuples

Append2 adds two items.

func (Int64Int64Tuples) Append3 added in v0.3.0

func (ts Int64Int64Tuples) Append3(k1 int64, v1 int64, k2 int64, v2 int64, k3 int64, v3 int64) Int64Int64Tuples

Append3 adds three items.

func (Int64Int64Tuples) MkString added in v0.6.0

func (ts Int64Int64Tuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (Int64Int64Tuples) MkString4 added in v0.7.0

func (ts Int64Int64Tuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (Int64Int64Tuples) String added in v0.6.0

func (ts Int64Int64Tuples) String() string

func (Int64Int64Tuples) ToMap added in v0.6.0

func (ts Int64Int64Tuples) ToMap() *Int64Int64Map

ToMap converts the tuples to a map.

func (Int64Int64Tuples) Values added in v0.3.0

func (ts Int64Int64Tuples) Values(values ...int64) Int64Int64Tuples

Values sets the values in a tuple slice. Use this with Int64Int64Zip.

type Int64List added in v0.3.0

type Int64List struct {
	// contains filtered or unexported fields
}

Int64List contains a slice of type int64. It is designed to be immutable - ideal for race-free reference lists etc. It encapsulates the slice and provides methods to access it. Importantly, *none of its methods ever mutate a list*; they merely return new lists where required.

List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq

func BuildInt64ListFromChan added in v0.3.0

func BuildInt64ListFromChan(source <-chan int64) *Int64List

BuildInt64ListFromChan constructs a new Int64List from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.

func ConvertInt64List added in v0.3.0

func ConvertInt64List(values ...interface{}) (*Int64List, bool)

ConvertInt64List 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. Conversions are provided from all built-in numeric types.

func NewInt64List added in v0.3.0

func NewInt64List(values ...int64) *Int64List

NewInt64List constructs a new list containing the supplied values, if any.

func (*Int64List) Append added in v0.3.0

func (list *Int64List) Append(more ...int64) *Int64List

Append returns a new list with all original items and all in `more`; they retain their order. The original list is not altered.

func (*Int64List) Clone added in v0.3.0

func (list *Int64List) Clone() *Int64List

Clone returns the same list, which is immutable.

func (*Int64List) Contains added in v0.3.0

func (list *Int64List) Contains(v int64) bool

Contains determines whether a given item is already in the list, returning true if so.

func (*Int64List) ContainsAll added in v0.3.0

func (list *Int64List) ContainsAll(i ...int64) bool

ContainsAll determines whether the given items are all in the list, returning true if so. This is potentially a slow method and should only be used rarely.

func (*Int64List) CountBy added in v0.3.0

func (list *Int64List) CountBy(p func(int64) bool) (result int)

CountBy gives the number elements of Int64List that return true for the predicate p.

func (*Int64List) DistinctBy added in v0.3.0

func (list *Int64List) DistinctBy(equal func(int64, int64) bool) *Int64List

DistinctBy returns a new Int64List whose elements are unique, where equality is defined by the equal function.

func (*Int64List) Drop added in v0.3.0

func (list *Int64List) Drop(n int) *Int64List

Drop returns a slice of Int64List 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 (*Int64List) DropLast added in v0.3.0

func (list *Int64List) DropLast(n int) *Int64List

DropLast returns a slice of Int64List 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 (*Int64List) DropWhile added in v0.3.0

func (list *Int64List) DropWhile(p func(int64) bool) *Int64List

DropWhile returns a new Int64List 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 elements are added.

func (*Int64List) Equals added in v0.3.0

func (list *Int64List) Equals(other *Int64List) 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. Nil lists are considered to be empty.

func (*Int64List) Exists added in v0.3.0

func (list *Int64List) Exists(p func(int64) bool) bool

Exists verifies that one or more elements of Int64List return true for the predicate p.

func (*Int64List) Filter added in v0.3.0

func (list *Int64List) Filter(p func(int64) bool) *Int64List

Filter returns a new Int64List whose elements return true for predicate p.

func (*Int64List) Find added in v0.3.0

func (list *Int64List) Find(p func(int64) bool) (int64, bool)

Find returns the first int64 that returns true for predicate p. False is returned if none match.

func (*Int64List) FlatMap added in v0.3.0

func (list *Int64List) FlatMap(f func(int64) []int64) *Int64List

FlatMap returns a new Int64List by transforming every element with function f that returns zero or more items in a slice. The resulting list may have a different size to the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Int64List) FlatMapToString added in v0.3.0

func (list *Int64List) FlatMapToString(f func(int64) []string) []string

FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Int64List) Fold added in v0.9.0

func (list *Int64List) Fold(initial int64, fn func(int64, int64) int64) int64

Fold aggregates all the values in the list using a supplied function, starting from some initial value.

func (*Int64List) Forall added in v0.3.0

func (list *Int64List) Forall(p func(int64) bool) bool

Forall verifies that all elements of Int64List return true for the predicate p.

func (*Int64List) Foreach added in v0.3.0

func (list *Int64List) Foreach(f func(int64))

Foreach iterates over Int64List and executes function f against each element. The function receives copies that do not alter the list elements when they are changed.

func (*Int64List) Get added in v0.3.0

func (list *Int64List) Get(i int) int64

Get gets the specified element in the list. Panics if the index is out of range or the list is nil.

func (*Int64List) GobDecode added in v0.3.0

func (list *Int64List) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this list type. You must register int64 with the 'gob' package before this method is used.

func (Int64List) GobEncode added in v0.3.0

func (list Int64List) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register int64 with the 'gob' package before this method is used.

func (*Int64List) Head added in v0.3.0

func (list *Int64List) Head() int64

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 or nil.

func (*Int64List) HeadOption added in v0.3.0

func (list *Int64List) HeadOption() (int64, bool)

HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.

func (*Int64List) IndexWhere added in v0.3.0

func (list *Int64List) IndexWhere(p func(int64) bool) int

IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.

func (*Int64List) IndexWhere2 added in v0.3.0

func (list *Int64List) IndexWhere2(p func(int64) bool, from int) int

IndexWhere2 finds the index of the first element satisfying predicate p at or after some start index. If none exists, -1 is returned.

func (*Int64List) Init added in v0.3.0

func (list *Int64List) Init() *Int64List

Init gets everything except the last. Init plus Last include the whole list. Init is the opposite of Tail. Panics if list is empty or nil.

func (*Int64List) IsEmpty added in v0.3.0

func (list *Int64List) IsEmpty() bool

IsEmpty tests whether Int64List is empty.

func (*Int64List) IsSequence added in v0.3.0

func (list *Int64List) IsSequence() bool

IsSequence returns true for lists and queues.

func (*Int64List) IsSet added in v0.3.0

func (list *Int64List) IsSet() bool

IsSet returns false for lists or queues.

func (*Int64List) Last added in v0.3.0

func (list *Int64List) Last() int64

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 or nil.

func (*Int64List) LastIndexWhere added in v0.3.0

func (list *Int64List) LastIndexWhere(p func(int64) bool) int

LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.

func (*Int64List) LastIndexWhere2 added in v0.3.0

func (list *Int64List) LastIndexWhere2(p func(int64) bool, before int) int

LastIndexWhere2 finds the index of the last element satisfying predicate p at or before some start index. If none exists, -1 is returned.

func (*Int64List) LastOption added in v0.3.0

func (list *Int64List) LastOption() (int64, bool)

LastOption gets the last element in the list, if possible. Otherwise returns the zero value.

func (*Int64List) Len added in v0.3.0

func (list *Int64List) Len() int

Len returns the number of items in the list - an alias of Size().

func (*Int64List) Map added in v0.3.0

func (list *Int64List) Map(f func(int64) int64) *Int64List

Map returns a new Int64List by transforming every element with function f. The resulting list is the same size as the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Int64List) MapToString added in v0.3.0

func (list *Int64List) MapToString(f func(int64) string) []string

MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (Int64List) MarshalJSON added in v0.3.0

func (list Int64List) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this list type.

func (*Int64List) Max added in v0.3.0

func (list *Int64List) Max() (result int64)

Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.

func (*Int64List) MaxBy added in v0.3.0

func (list *Int64List) MaxBy(less func(int64, int64) bool) int64

MaxBy returns an element of Int64List 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 (*Int64List) Min added in v0.3.0

func (list *Int64List) Min() int64

Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.

func (*Int64List) MinBy added in v0.3.0

func (list *Int64List) MinBy(less func(int64, int64) bool) int64

MinBy returns an element of Int64List 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 (*Int64List) MkString added in v0.3.0

func (list *Int64List) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*Int64List) MkString3 added in v0.3.0

func (list *Int64List) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*Int64List) NonEmpty added in v0.3.0

func (list *Int64List) NonEmpty() bool

NonEmpty tests whether Int64List is empty.

func (*Int64List) Partition added in v0.3.0

func (list *Int64List) Partition(p func(int64) bool) (*Int64List, *Int64List)

Partition returns two new int64Lists 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.

func (*Int64List) Reverse added in v0.3.0

func (list *Int64List) Reverse() *Int64List

Reverse returns a copy of Int64List with all elements in the reverse order.

func (*Int64List) Send added in v0.3.0

func (list *Int64List) Send() <-chan int64

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. The channel will be closed when all the elements have been sent.

func (*Int64List) Shuffle added in v0.3.0

func (list *Int64List) Shuffle() *Int64List

Shuffle returns a shuffled copy of Int64List, using a version of the Fisher-Yates shuffle.

func (*Int64List) Size added in v0.3.0

func (list *Int64List) Size() int

Size returns the number of items in the list - an alias of Len().

func (*Int64List) SortBy added in v0.3.0

func (list *Int64List) SortBy(less func(i, j int64) bool) *Int64List

SortBy returns a new list in which the elements are sorted by a specified ordering.

func (*Int64List) Sorted added in v0.3.0

func (list *Int64List) Sorted() *Int64List

Sorted returns a new list in which the elements are sorted by their natural ordering.

func (*Int64List) StableSortBy added in v0.3.0

func (list *Int64List) StableSortBy(less func(i, j int64) bool) *Int64List

StableSortBy returns a new list in which the elements are sorted by a specified ordering. The algorithm keeps the original order of equal elements.

func (*Int64List) StableSorted added in v0.3.0

func (list *Int64List) StableSorted() *Int64List

StableSorted returns a new list in which the elements are sorted by their natural ordering.

func (*Int64List) String added in v0.3.0

func (list *Int64List) String() string

String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.

func (*Int64List) StringList added in v0.3.0

func (list *Int64List) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*Int64List) Sum added in v0.3.0

func (list *Int64List) Sum() int64

Sum returns the sum of all the elements in the list.

func (*Int64List) Tail added in v0.3.0

func (list *Int64List) Tail() *Int64List

Tail gets everything except the head. Head plus Tail include the whole list. Tail is the opposite of Init. Panics if list is empty or nil.

func (*Int64List) Take added in v0.3.0

func (list *Int64List) Take(n int) *Int64List

Take returns a slice of Int64List containing the leading n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.

func (*Int64List) TakeLast added in v0.3.0

func (list *Int64List) TakeLast(n int) *Int64List

TakeLast returns a slice of Int64List containing the trailing n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.

func (*Int64List) TakeWhile added in v0.3.0

func (list *Int64List) TakeWhile(p func(int64) bool) *Int64List

TakeWhile returns a new Int64List 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 elements are excluded.

func (*Int64List) ToInterfaceSlice added in v0.3.0

func (list *Int64List) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.

func (*Int64List) ToList added in v0.3.0

func (list *Int64List) ToList() *Int64List

ToList returns the elements of the list as a list, which is an identity operation in this case.

func (*Int64List) ToSet added in v0.3.0

func (list *Int64List) ToSet() *Int64Set

ToSet returns the elements of the list as a set. The returned set is a shallow copy; the list is not altered.

func (*Int64List) ToSlice added in v0.3.0

func (list *Int64List) ToSlice() []int64

ToSlice returns the elements of the current list as a slice.

func (*Int64List) UnmarshalJSON added in v0.3.0

func (list *Int64List) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this list type.

type Int64MkStringer added in v0.3.0

type Int64MkStringer interface {
	// String implements the Stringer interface to render the list as a comma-separated string enclosed
	// in square brackets.
	String() string

	// MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
	MkString(sep string) string

	// MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
	MkString3(before, between, after string) string

	// implements json.Marshaler interface {
	MarshalJSON() ([]byte, error)

	// StringList gets a slice of strings that depicts all the elements.
	StringList() []string
}

Int64MkStringer defines an interface for stringer methods on int64 collections.

type Int64Sequence added in v0.9.0

type Int64Sequence interface {
	Int64Collection

	// Head gets the first element in the sequence. Head plus Tail include the whole sequence. Head is the opposite of Last.
	Head() int64

	// HeadOption gets the first element in the sequence, if possible.
	HeadOption() (int64, bool)

	// Last gets the last element in the sequence. Init plus Last include the whole sequence. Last is the opposite of Head.
	Last() int64

	// LastOption gets the last element in the sequence, if possible.
	LastOption() (int64, bool)
}

Int64Sequence defines an interface for sequence methods on int64.

type Int64Set added in v0.3.0

type Int64Set struct {
	// contains filtered or unexported fields
}

Int64Set is the primary type that represents a set.

func BuildInt64SetFromChan added in v0.3.0

func BuildInt64SetFromChan(source <-chan int64) *Int64Set

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 added in v0.3.0

func ConvertInt64Set(values ...interface{}) (*Int64Set, bool)

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. The returned set will contain all the values that were correctly converted.

func NewInt64Set added in v0.3.0

func NewInt64Set(values ...int64) *Int64Set

NewInt64Set creates and returns a reference to an empty set.

func (*Int64Set) Add added in v0.3.0

func (set *Int64Set) Add(more ...int64) *Int64Set

Add returns a new set with all original items and all in `more`. The original set is not altered.

func (*Int64Set) Cardinality added in v0.3.0

func (set *Int64Set) Cardinality() int

Cardinality returns how many items are currently in the set. This is a synonym for Size.

func (*Int64Set) Clone added in v0.3.0

func (set *Int64Set) Clone() *Int64Set

Clone returns the same set, which is immutable.

func (*Int64Set) Contains added in v0.3.0

func (set *Int64Set) Contains(i int64) bool

Contains determines whether a given item is already in the set, returning true if so.

func (*Int64Set) ContainsAll added in v0.3.0

func (set *Int64Set) ContainsAll(i ...int64) bool

ContainsAll determines whether a given item is already in the set, returning true if so.

func (*Int64Set) CountBy added in v0.3.0

func (set *Int64Set) CountBy(p func(int64) bool) (result int)

CountBy gives the number elements of Int64Set that return true for the predicate p.

func (*Int64Set) Difference added in v0.3.0

func (set *Int64Set) Difference(other *Int64Set) *Int64Set

Difference returns a new set with items in the current set but not in the other set

func (*Int64Set) Equals added in v0.3.0

func (set *Int64Set) Equals(other *Int64Set) bool

Equals determines whether two sets are equal to each other, returning true if so. 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 added in v0.3.0

func (set *Int64Set) Exists(p func(int64) bool) bool

Exists applies a predicate p 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 added in v0.3.0

func (set *Int64Set) Filter(p func(int64) bool) *Int64Set

Filter returns a new Int64Set whose elements return true for the predicate p.

func (*Int64Set) Find added in v0.3.0

func (set *Int64Set) Find(p func(int64) bool) (int64, bool)

Find returns the first int64 that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.

func (*Int64Set) FlatMap added in v0.3.0

func (set *Int64Set) FlatMap(f func(int64) []int64) *Int64Set

FlatMap returns a new Int64Set by transforming every element with a function f that returns zero or more items in a slice. The resulting set may have a different size to the original set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Int64Set) FlatMapToString added in v0.3.0

func (set *Int64Set) FlatMapToString(f func(int64) []string) []string

FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Int64Set) Fold added in v0.9.0

func (set *Int64Set) Fold(initial int64, fn func(int64, int64) int64) int64

Fold aggregates all the values in the set using a supplied function, starting from some initial value.

func (*Int64Set) Forall added in v0.3.0

func (set *Int64Set) Forall(p func(int64) bool) bool

Forall applies a predicate function p 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 added in v0.3.0

func (set *Int64Set) Foreach(f func(int64))

Foreach iterates over int64Set and executes the function f against each element.

func (*Int64Set) GobDecode added in v0.3.0

func (set *Int64Set) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this set type. You must register int64 with the 'gob' package before this method is used.

func (Int64Set) GobEncode added in v0.3.0

func (set Int64Set) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register int64 with the 'gob' package before this method is used.

func (*Int64Set) Intersect added in v0.3.0

func (set *Int64Set) Intersect(other *Int64Set) *Int64Set

Intersect returns a new set with items that exist only in both sets.

func (*Int64Set) IsEmpty added in v0.3.0

func (set *Int64Set) IsEmpty() bool

IsEmpty returns true if the set is empty.

func (*Int64Set) IsSequence added in v0.3.0

func (set *Int64Set) IsSequence() bool

IsSequence returns true for lists and queues.

func (*Int64Set) IsSet added in v0.3.0

func (set *Int64Set) IsSet() bool

IsSet returns false for lists or queues.

func (*Int64Set) IsSubset added in v0.3.0

func (set *Int64Set) IsSubset(other *Int64Set) bool

IsSubset determines whether every item in the other set is in this set, returning true if so.

func (*Int64Set) IsSuperset added in v0.3.0

func (set *Int64Set) IsSuperset(other *Int64Set) bool

IsSuperset determines whether every item of this set is in the other set, returning true if so.

func (*Int64Set) Map added in v0.3.0

func (set *Int64Set) Map(f func(int64) int64) *Int64Set

Map returns a new Int64Set by transforming every element with a function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Int64Set) MapToString added in v0.3.0

func (set *Int64Set) MapToString(f func(int64) string) []string

MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Int64Set) MarshalJSON added in v0.3.0

func (set *Int64Set) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this set type.

func (*Int64Set) Max added in v0.3.0

func (set *Int64Set) Max() (result int64)

Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.

func (*Int64Set) MaxBy added in v0.3.0

func (set *Int64Set) MaxBy(less func(int64, int64) bool) int64

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 added in v0.3.0

func (set *Int64Set) Min() int64

Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.

func (*Int64Set) MinBy added in v0.3.0

func (set *Int64Set) MinBy(less func(int64, int64) bool) int64

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) MkString added in v0.3.0

func (set *Int64Set) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*Int64Set) MkString3 added in v0.3.0

func (set *Int64Set) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*Int64Set) NonEmpty added in v0.3.0

func (set *Int64Set) NonEmpty() bool

NonEmpty returns true if the set is not empty.

func (*Int64Set) Partition added in v0.3.0

func (set *Int64Set) Partition(p func(int64) bool) (*Int64Set, *Int64Set)

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.

func (*Int64Set) Remove added in v0.3.0

func (set *Int64Set) Remove(i int64) *Int64Set

Remove removes a single item from the set. A new set is returned that has all the elements except the removed one.

func (*Int64Set) Send added in v0.3.0

func (set *Int64Set) Send() <-chan int64

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 added in v0.3.0

func (set *Int64Set) Size() int

Size returns how many items are currently in the set. This is a synonym for Cardinality.

func (*Int64Set) String added in v0.3.0

func (set *Int64Set) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*Int64Set) StringList added in v0.3.0

func (set *Int64Set) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*Int64Set) StringMap added in v0.3.0

func (set *Int64Set) StringMap() map[string]bool

StringMap renders the set as a map of strings. The value of each item in the set becomes stringified as a key in the resulting map.

func (*Int64Set) Sum added in v0.3.0

func (set *Int64Set) Sum() int64

Sum returns the sum of all the elements in the set.

func (*Int64Set) SymmetricDifference added in v0.3.0

func (set *Int64Set) SymmetricDifference(other *Int64Set) *Int64Set

SymmetricDifference returns a new set with items in the current set or the other set but not in both.

func (*Int64Set) ToInterfaceSlice added in v0.3.0

func (set *Int64Set) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.

func (*Int64Set) ToList added in v0.3.0

func (set *Int64Set) ToList() *Int64List

ToList returns the elements of the set as a list. The returned list is a shallow copy; the set is not altered.

func (*Int64Set) ToSet added in v0.3.0

func (set *Int64Set) ToSet() *Int64Set

ToSet returns the set; this is an identity operation in this case.

func (*Int64Set) ToSlice added in v0.3.0

func (set *Int64Set) ToSlice() []int64

ToSlice returns the elements of the current set as a slice.

func (*Int64Set) Union added in v0.3.0

func (set *Int64Set) Union(other *Int64Set) *Int64Set

Union returns a new set with all items in both sets.

func (*Int64Set) UnmarshalJSON added in v0.3.0

func (set *Int64Set) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this set type.

type Int64Sizer added in v0.3.0

type Int64Sizer interface {
	// IsEmpty tests whether Int64Collection is empty.
	IsEmpty() bool

	// NonEmpty tests whether Int64Collection is empty.
	NonEmpty() bool

	// Size returns the number of items in the list - an alias of Len().
	Size() int
}

Int64Sizer defines an interface for sizing methods on int64 collections.

type Int64StringMap added in v0.4.0

type Int64StringMap struct {
	// contains filtered or unexported fields
}

Int64StringMap is the primary type that represents a thread-safe map

func NewInt64StringMap added in v0.4.0

func NewInt64StringMap(kv ...Int64StringTuple) *Int64StringMap

NewInt64StringMap creates and returns a reference to a map, optionally containing some items.

func NewInt64StringMap1 added in v0.4.0

func NewInt64StringMap1(k int64, v string) *Int64StringMap

NewInt64StringMap1 creates and returns a reference to a map containing one item.

func (*Int64StringMap) Clone added in v0.4.0

func (mm *Int64StringMap) Clone() *Int64StringMap

Clone returns the same map, which is immutable.

func (*Int64StringMap) ContainsAllKeys added in v0.4.0

func (mm *Int64StringMap) ContainsAllKeys(kk ...int64) bool

ContainsAllKeys determines if the given items are all in the map.

func (*Int64StringMap) ContainsKey added in v0.4.0

func (mm *Int64StringMap) ContainsKey(k int64) bool

ContainsKey determines if a given item is already in the map.

func (*Int64StringMap) Equals added in v0.4.0

func (mm *Int64StringMap) Equals(other *Int64StringMap) bool

Equals determines if two maps 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 maps to be equal.

func (*Int64StringMap) Exists added in v0.4.0

func (mm *Int64StringMap) Exists(p func(int64, string) bool) bool

Exists applies the predicate p 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 (*Int64StringMap) Filter added in v0.4.0

func (mm *Int64StringMap) Filter(p func(int64, string) bool) *Int64StringMap

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*Int64StringMap) Find added in v0.4.0

func (mm *Int64StringMap) Find(p func(int64, string) bool) (Int64StringTuple, bool)

Find returns the first string that returns true for the predicate p. False is returned if none match.

func (*Int64StringMap) FlatMap added in v0.4.0

func (mm *Int64StringMap) FlatMap(f func(int64, string) []Int64StringTuple) *Int64StringMap

FlatMap returns a new StringMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Int64StringMap) Forall added in v0.4.0

func (mm *Int64StringMap) Forall(f func(int64, string) bool) bool

Forall applies the predicate p 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 (*Int64StringMap) Foreach added in v0.4.0

func (mm *Int64StringMap) Foreach(f func(int64, string))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*Int64StringMap) Get added in v0.4.0

func (mm *Int64StringMap) Get(k int64) (string, bool)

Get returns one of the items in the map, if present.

func (*Int64StringMap) GobDecode added in v0.4.0

func (mm *Int64StringMap) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register string with the 'gob' package before this method is used.

func (*Int64StringMap) GobEncode added in v0.4.0

func (mm *Int64StringMap) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register string with the 'gob' package before this method is used.

func (*Int64StringMap) IsEmpty added in v0.4.0

func (mm *Int64StringMap) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*Int64StringMap) Keys added in v0.4.0

func (mm *Int64StringMap) Keys() collection.Int64List

Keys returns the keys of the current map as a slice.

func (*Int64StringMap) Map added in v0.4.0

func (mm *Int64StringMap) Map(f func(int64, string) (int64, string)) *Int64StringMap

Map returns a new StringMap by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Int64StringMap) MkString added in v0.4.0

func (mm *Int64StringMap) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*Int64StringMap) MkString4 added in v0.7.0

func (mm *Int64StringMap) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*Int64StringMap) NonEmpty added in v0.4.0

func (mm *Int64StringMap) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*Int64StringMap) OrderedSlice added in v0.6.0

func (mm *Int64StringMap) OrderedSlice(keys collection.Int64List) Int64StringTuples

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*Int64StringMap) Partition added in v0.4.0

func (mm *Int64StringMap) Partition(p func(int64, string) bool) (matching *Int64StringMap, others *Int64StringMap)

Partition applies the predicate p 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.

func (*Int64StringMap) Put added in v0.4.0

func (mm *Int64StringMap) Put(k int64, v string) *Int64StringMap

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*Int64StringMap) Size added in v0.4.0

func (mm *Int64StringMap) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*Int64StringMap) String added in v0.4.0

func (mm *Int64StringMap) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*Int64StringMap) ToSlice added in v0.4.0

func (mm *Int64StringMap) ToSlice() Int64StringTuples

ToSlice returns the key/value pairs as a slice

func (*Int64StringMap) Values added in v0.4.0

func (mm *Int64StringMap) Values() collection.StringList

Values returns the values of the current map as a slice.

type Int64StringTuple added in v0.4.0

type Int64StringTuple struct {
	Key int64
	Val string
}

Int64StringTuple represents a key/value pair.

func (Int64StringTuple) MarshalJSON added in v0.6.0

func (t Int64StringTuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (Int64StringTuple) UnmarshalJSON added in v0.6.0

func (t Int64StringTuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type Int64StringTuples added in v0.4.0

type Int64StringTuples []Int64StringTuple

Int64StringTuples can be used as a builder for unmodifiable maps.

func Int64StringZip added in v0.4.0

func Int64StringZip(keys ...int64) Int64StringTuples

Int64StringZip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewInt64StringMap constructor function.

func (Int64StringTuples) Append1 added in v0.4.0

Append1 adds one item.

func (Int64StringTuples) Append2 added in v0.4.0

func (ts Int64StringTuples) Append2(k1 int64, v1 string, k2 int64, v2 string) Int64StringTuples

Append2 adds two items.

func (Int64StringTuples) Append3 added in v0.4.0

func (ts Int64StringTuples) Append3(k1 int64, v1 string, k2 int64, v2 string, k3 int64, v3 string) Int64StringTuples

Append3 adds three items.

func (Int64StringTuples) MkString added in v0.6.0

func (ts Int64StringTuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (Int64StringTuples) MkString4 added in v0.7.0

func (ts Int64StringTuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (Int64StringTuples) String added in v0.6.0

func (ts Int64StringTuples) String() string

func (Int64StringTuples) ToMap added in v0.6.0

func (ts Int64StringTuples) ToMap() *Int64StringMap

ToMap converts the tuples to a map.

func (Int64StringTuples) Values added in v0.4.0

func (ts Int64StringTuples) Values(values ...string) Int64StringTuples

Values sets the values in a tuple slice. Use this with Int64StringZip.

type IntCollection added in v0.3.0

type IntCollection interface {
	IntSizer
	IntMkStringer

	// IsSequence returns true for lists and queues.
	IsSequence() bool

	// IsSet returns false for lists and queues.
	IsSet() bool

	// ToSlice returns a shallow copy as a plain slice.
	ToSlice() []int

	// ToInterfaceSlice returns a shallow copy as a slice of arbitrary type.
	ToInterfaceSlice() []interface{}

	// Exists verifies that one or more elements of IntCollection return true for the predicate p.
	Exists(p func(int) bool) bool

	// Forall verifies that all elements of IntCollection return true for the predicate p.
	Forall(p func(int) bool) bool

	// Foreach iterates over IntCollection and executes the function f against each element.
	Foreach(f func(int))

	// Find returns the first int that returns true for the predicate p.
	// False is returned if none match.
	Find(p func(int) bool) (int, bool)

	// MapToString returns a new []string by transforming every element with function f.
	// The resulting slice is the same size as the collection. The collection is not modified.
	MapToString(f func(int) string) []string

	// FlatMapString returns a new []string by transforming every element with function f
	// that returns zero or more items in a slice. The resulting slice may have a different size to the
	// collection. The collection is not modified.
	FlatMapToString(f func(int) []string) []string

	// Send returns a channel that will send all the elements in order. Can be used with the plumbing code, for example.
	// A goroutine is created to send the elements; this only terminates when all the elements have been consumed
	Send() <-chan int

	// CountBy gives the number elements of IntCollection that return true for the predicate p.
	CountBy(p func(int) bool) int

	// Contains determines whether a given item is already in the collection, returning true if so.
	Contains(v int) bool

	// ContainsAll determines whether the given items are all in the collection, returning true if so.
	ContainsAll(v ...int) bool

	// Min returns the minimum value of all the items in the collection. Panics if there are no elements.
	Min() int

	// Max returns the minimum value of all the items in the collection. Panics if there are no elements.
	Max() int

	// MinBy returns an element of IntCollection 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.
	MinBy(less func(int, int) bool) int

	// MaxBy returns an element of IntCollection 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.
	MaxBy(less func(int, int) bool) int

	// Fold aggregates all the values in the collection using a supplied function, starting from some initial value.
	Fold(initial int, fn func(int, int) int) int

	// Sum returns the sum of all the elements in the collection.
	Sum() int
}

IntCollection defines an interface for common collection methods on int.

type IntIntMap added in v0.3.0

type IntIntMap struct {
	// contains filtered or unexported fields
}

IntIntMap is the primary type that represents a thread-safe map

func NewIntIntMap added in v0.3.0

func NewIntIntMap(kv ...IntIntTuple) *IntIntMap

NewIntIntMap creates and returns a reference to a map, optionally containing some items.

func NewIntIntMap1 added in v0.3.0

func NewIntIntMap1(k int, v int) *IntIntMap

NewIntIntMap1 creates and returns a reference to a map containing one item.

func (*IntIntMap) Clone added in v0.3.0

func (mm *IntIntMap) Clone() *IntIntMap

Clone returns the same map, which is immutable.

func (*IntIntMap) ContainsAllKeys added in v0.3.0

func (mm *IntIntMap) ContainsAllKeys(kk ...int) bool

ContainsAllKeys determines if the given items are all in the map.

func (*IntIntMap) ContainsKey added in v0.3.0

func (mm *IntIntMap) ContainsKey(k int) bool

ContainsKey determines if a given item is already in the map.

func (*IntIntMap) Equals added in v0.3.0

func (mm *IntIntMap) Equals(other *IntIntMap) bool

Equals determines if two maps 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 maps to be equal.

func (*IntIntMap) Exists added in v0.3.0

func (mm *IntIntMap) Exists(p func(int, int) bool) bool

Exists applies the predicate p 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 (*IntIntMap) Filter added in v0.3.0

func (mm *IntIntMap) Filter(p func(int, int) bool) *IntIntMap

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*IntIntMap) Find added in v0.3.0

func (mm *IntIntMap) Find(p func(int, int) bool) (IntIntTuple, bool)

Find returns the first int that returns true for the predicate p. False is returned if none match.

func (*IntIntMap) FlatMap added in v0.3.0

func (mm *IntIntMap) FlatMap(f func(int, int) []IntIntTuple) *IntIntMap

FlatMap returns a new IntMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*IntIntMap) Forall added in v0.3.0

func (mm *IntIntMap) Forall(f func(int, int) bool) bool

Forall applies the predicate p 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 (*IntIntMap) Foreach added in v0.3.0

func (mm *IntIntMap) Foreach(f func(int, int))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*IntIntMap) Get added in v0.3.0

func (mm *IntIntMap) Get(k int) (int, bool)

Get returns one of the items in the map, if present.

func (*IntIntMap) GobDecode added in v0.3.0

func (mm *IntIntMap) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register int with the 'gob' package before this method is used.

func (*IntIntMap) GobEncode added in v0.3.0

func (mm *IntIntMap) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register int with the 'gob' package before this method is used.

func (*IntIntMap) IsEmpty added in v0.3.0

func (mm *IntIntMap) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*IntIntMap) Keys added in v0.3.0

func (mm *IntIntMap) Keys() collection.IntList

Keys returns the keys of the current map as a slice.

func (*IntIntMap) Map added in v0.3.0

func (mm *IntIntMap) Map(f func(int, int) (int, int)) *IntIntMap

Map returns a new IntMap by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*IntIntMap) MkString added in v0.3.0

func (mm *IntIntMap) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*IntIntMap) MkString4 added in v0.7.0

func (mm *IntIntMap) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*IntIntMap) NonEmpty added in v0.3.0

func (mm *IntIntMap) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*IntIntMap) OrderedSlice added in v0.6.0

func (mm *IntIntMap) OrderedSlice(keys collection.IntList) IntIntTuples

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*IntIntMap) Partition added in v0.3.0

func (mm *IntIntMap) Partition(p func(int, int) bool) (matching *IntIntMap, others *IntIntMap)

Partition applies the predicate p 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.

func (*IntIntMap) Put added in v0.3.0

func (mm *IntIntMap) Put(k int, v int) *IntIntMap

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*IntIntMap) Size added in v0.3.0

func (mm *IntIntMap) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*IntIntMap) String added in v0.3.0

func (mm *IntIntMap) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*IntIntMap) ToSlice added in v0.3.0

func (mm *IntIntMap) ToSlice() IntIntTuples

ToSlice returns the key/value pairs as a slice

func (*IntIntMap) Values added in v0.3.0

func (mm *IntIntMap) Values() collection.IntList

Values returns the values of the current map as a slice.

type IntIntTuple added in v0.3.0

type IntIntTuple struct {
	Key int
	Val int
}

IntIntTuple represents a key/value pair.

func (IntIntTuple) MarshalJSON added in v0.6.0

func (t IntIntTuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (IntIntTuple) UnmarshalJSON added in v0.6.0

func (t IntIntTuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type IntIntTuples added in v0.3.0

type IntIntTuples []IntIntTuple

IntIntTuples can be used as a builder for unmodifiable maps.

func IntIntZip added in v0.3.0

func IntIntZip(keys ...int) IntIntTuples

IntIntZip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewIntIntMap constructor function.

func (IntIntTuples) Append1 added in v0.3.0

func (ts IntIntTuples) Append1(k int, v int) IntIntTuples

Append1 adds one item.

func (IntIntTuples) Append2 added in v0.3.0

func (ts IntIntTuples) Append2(k1 int, v1 int, k2 int, v2 int) IntIntTuples

Append2 adds two items.

func (IntIntTuples) Append3 added in v0.3.0

func (ts IntIntTuples) Append3(k1 int, v1 int, k2 int, v2 int, k3 int, v3 int) IntIntTuples

Append3 adds three items.

func (IntIntTuples) MkString added in v0.6.0

func (ts IntIntTuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (IntIntTuples) MkString4 added in v0.7.0

func (ts IntIntTuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (IntIntTuples) String added in v0.6.0

func (ts IntIntTuples) String() string

func (IntIntTuples) ToMap added in v0.6.0

func (ts IntIntTuples) ToMap() *IntIntMap

ToMap converts the tuples to a map.

func (IntIntTuples) Values added in v0.3.0

func (ts IntIntTuples) Values(values ...int) IntIntTuples

Values sets the values in a tuple slice. Use this with IntIntZip.

type IntList added in v0.3.0

type IntList struct {
	// contains filtered or unexported fields
}

IntList contains a slice of type int. It is designed to be immutable - ideal for race-free reference lists etc. It encapsulates the slice and provides methods to access it. Importantly, *none of its methods ever mutate a list*; they merely return new lists where required.

List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq

func BuildIntListFromChan added in v0.3.0

func BuildIntListFromChan(source <-chan int) *IntList

BuildIntListFromChan constructs a new IntList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.

func ConvertIntList added in v0.3.0

func ConvertIntList(values ...interface{}) (*IntList, bool)

ConvertIntList 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. Conversions are provided from all built-in numeric types.

func NewIntList added in v0.3.0

func NewIntList(values ...int) *IntList

NewIntList constructs a new list containing the supplied values, if any.

func (*IntList) Append added in v0.3.0

func (list *IntList) Append(more ...int) *IntList

Append returns a new list with all original items and all in `more`; they retain their order. The original list is not altered.

func (*IntList) Clone added in v0.3.0

func (list *IntList) Clone() *IntList

Clone returns the same list, which is immutable.

func (*IntList) Contains added in v0.3.0

func (list *IntList) Contains(v int) bool

Contains determines whether a given item is already in the list, returning true if so.

func (*IntList) ContainsAll added in v0.3.0

func (list *IntList) ContainsAll(i ...int) bool

ContainsAll determines whether the given items are all in the list, returning true if so. This is potentially a slow method and should only be used rarely.

func (*IntList) CountBy added in v0.3.0

func (list *IntList) CountBy(p func(int) bool) (result int)

CountBy gives the number elements of IntList that return true for the predicate p.

func (*IntList) DistinctBy added in v0.3.0

func (list *IntList) DistinctBy(equal func(int, int) bool) *IntList

DistinctBy returns a new IntList whose elements are unique, where equality is defined by the equal function.

func (*IntList) Drop added in v0.3.0

func (list *IntList) Drop(n int) *IntList

Drop returns a slice of IntList 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 (*IntList) DropLast added in v0.3.0

func (list *IntList) DropLast(n int) *IntList

DropLast returns a slice of IntList 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 (*IntList) DropWhile added in v0.3.0

func (list *IntList) DropWhile(p func(int) bool) *IntList

DropWhile returns a new IntList 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 elements are added.

func (*IntList) Equals added in v0.3.0

func (list *IntList) Equals(other *IntList) 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. Nil lists are considered to be empty.

func (*IntList) Exists added in v0.3.0

func (list *IntList) Exists(p func(int) bool) bool

Exists verifies that one or more elements of IntList return true for the predicate p.

func (*IntList) Filter added in v0.3.0

func (list *IntList) Filter(p func(int) bool) *IntList

Filter returns a new IntList whose elements return true for predicate p.

func (*IntList) Find added in v0.3.0

func (list *IntList) Find(p func(int) bool) (int, bool)

Find returns the first int that returns true for predicate p. False is returned if none match.

func (*IntList) FlatMap added in v0.3.0

func (list *IntList) FlatMap(f func(int) []int) *IntList

FlatMap returns a new IntList by transforming every element with function f that returns zero or more items in a slice. The resulting list may have a different size to the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*IntList) FlatMapToString added in v0.3.0

func (list *IntList) FlatMapToString(f func(int) []string) []string

FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*IntList) Fold added in v0.9.0

func (list *IntList) Fold(initial int, fn func(int, int) int) int

Fold aggregates all the values in the list using a supplied function, starting from some initial value.

func (*IntList) Forall added in v0.3.0

func (list *IntList) Forall(p func(int) bool) bool

Forall verifies that all elements of IntList return true for the predicate p.

func (*IntList) Foreach added in v0.3.0

func (list *IntList) Foreach(f func(int))

Foreach iterates over IntList and executes function f against each element. The function receives copies that do not alter the list elements when they are changed.

func (*IntList) Get added in v0.3.0

func (list *IntList) Get(i int) int

Get gets the specified element in the list. Panics if the index is out of range or the list is nil.

func (*IntList) GobDecode added in v0.3.0

func (list *IntList) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this list type. You must register int with the 'gob' package before this method is used.

func (IntList) GobEncode added in v0.3.0

func (list IntList) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register int with the 'gob' package before this method is used.

func (*IntList) Head added in v0.3.0

func (list *IntList) Head() int

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 or nil.

func (*IntList) HeadOption added in v0.3.0

func (list *IntList) HeadOption() (int, bool)

HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.

func (*IntList) IndexWhere added in v0.3.0

func (list *IntList) IndexWhere(p func(int) bool) int

IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.

func (*IntList) IndexWhere2 added in v0.3.0

func (list *IntList) IndexWhere2(p func(int) bool, from int) int

IndexWhere2 finds the index of the first element satisfying predicate p at or after some start index. If none exists, -1 is returned.

func (*IntList) Init added in v0.3.0

func (list *IntList) Init() *IntList

Init gets everything except the last. Init plus Last include the whole list. Init is the opposite of Tail. Panics if list is empty or nil.

func (*IntList) IsEmpty added in v0.3.0

func (list *IntList) IsEmpty() bool

IsEmpty tests whether IntList is empty.

func (*IntList) IsSequence added in v0.3.0

func (list *IntList) IsSequence() bool

IsSequence returns true for lists and queues.

func (*IntList) IsSet added in v0.3.0

func (list *IntList) IsSet() bool

IsSet returns false for lists or queues.

func (*IntList) Last added in v0.3.0

func (list *IntList) Last() int

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 or nil.

func (*IntList) LastIndexWhere added in v0.3.0

func (list *IntList) LastIndexWhere(p func(int) bool) int

LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.

func (*IntList) LastIndexWhere2 added in v0.3.0

func (list *IntList) LastIndexWhere2(p func(int) bool, before int) int

LastIndexWhere2 finds the index of the last element satisfying predicate p at or before some start index. If none exists, -1 is returned.

func (*IntList) LastOption added in v0.3.0

func (list *IntList) LastOption() (int, bool)

LastOption gets the last element in the list, if possible. Otherwise returns the zero value.

func (*IntList) Len added in v0.3.0

func (list *IntList) Len() int

Len returns the number of items in the list - an alias of Size().

func (*IntList) Map added in v0.3.0

func (list *IntList) Map(f func(int) int) *IntList

Map returns a new IntList by transforming every element with function f. The resulting list is the same size as the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*IntList) MapToString added in v0.3.0

func (list *IntList) MapToString(f func(int) string) []string

MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (IntList) MarshalJSON added in v0.3.0

func (list IntList) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this list type.

func (*IntList) Max added in v0.3.0

func (list *IntList) Max() (result int)

Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.

func (*IntList) MaxBy added in v0.3.0

func (list *IntList) MaxBy(less func(int, int) bool) int

MaxBy returns an element of IntList 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 (*IntList) Min added in v0.3.0

func (list *IntList) Min() int

Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.

func (*IntList) MinBy added in v0.3.0

func (list *IntList) MinBy(less func(int, int) bool) int

MinBy returns an element of IntList 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 (*IntList) MkString added in v0.3.0

func (list *IntList) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*IntList) MkString3 added in v0.3.0

func (list *IntList) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*IntList) NonEmpty added in v0.3.0

func (list *IntList) NonEmpty() bool

NonEmpty tests whether IntList is empty.

func (*IntList) Partition added in v0.3.0

func (list *IntList) Partition(p func(int) bool) (*IntList, *IntList)

Partition returns two new intLists 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.

func (*IntList) Reverse added in v0.3.0

func (list *IntList) Reverse() *IntList

Reverse returns a copy of IntList with all elements in the reverse order.

func (*IntList) Send added in v0.3.0

func (list *IntList) Send() <-chan int

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. The channel will be closed when all the elements have been sent.

func (*IntList) Shuffle added in v0.3.0

func (list *IntList) Shuffle() *IntList

Shuffle returns a shuffled copy of IntList, using a version of the Fisher-Yates shuffle.

func (*IntList) Size added in v0.3.0

func (list *IntList) Size() int

Size returns the number of items in the list - an alias of Len().

func (*IntList) SortBy added in v0.3.0

func (list *IntList) SortBy(less func(i, j int) bool) *IntList

SortBy returns a new list in which the elements are sorted by a specified ordering.

func (*IntList) Sorted added in v0.3.0

func (list *IntList) Sorted() *IntList

Sorted returns a new list in which the elements are sorted by their natural ordering.

func (*IntList) StableSortBy added in v0.3.0

func (list *IntList) StableSortBy(less func(i, j int) bool) *IntList

StableSortBy returns a new list in which the elements are sorted by a specified ordering. The algorithm keeps the original order of equal elements.

func (*IntList) StableSorted added in v0.3.0

func (list *IntList) StableSorted() *IntList

StableSorted returns a new list in which the elements are sorted by their natural ordering.

func (*IntList) String added in v0.3.0

func (list *IntList) String() string

String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.

func (*IntList) StringList added in v0.3.0

func (list *IntList) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*IntList) Sum added in v0.3.0

func (list *IntList) Sum() int

Sum returns the sum of all the elements in the list.

func (*IntList) Tail added in v0.3.0

func (list *IntList) Tail() *IntList

Tail gets everything except the head. Head plus Tail include the whole list. Tail is the opposite of Init. Panics if list is empty or nil.

func (*IntList) Take added in v0.3.0

func (list *IntList) Take(n int) *IntList

Take returns a slice of IntList containing the leading n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.

func (*IntList) TakeLast added in v0.3.0

func (list *IntList) TakeLast(n int) *IntList

TakeLast returns a slice of IntList containing the trailing n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.

func (*IntList) TakeWhile added in v0.3.0

func (list *IntList) TakeWhile(p func(int) bool) *IntList

TakeWhile returns a new IntList 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 elements are excluded.

func (*IntList) ToInterfaceSlice added in v0.3.0

func (list *IntList) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.

func (*IntList) ToList added in v0.3.0

func (list *IntList) ToList() *IntList

ToList returns the elements of the list as a list, which is an identity operation in this case.

func (*IntList) ToSet added in v0.3.0

func (list *IntList) ToSet() *IntSet

ToSet returns the elements of the list as a set. The returned set is a shallow copy; the list is not altered.

func (*IntList) ToSlice added in v0.3.0

func (list *IntList) ToSlice() []int

ToSlice returns the elements of the current list as a slice.

func (*IntList) UnmarshalJSON added in v0.3.0

func (list *IntList) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this list type.

type IntMkStringer added in v0.3.0

type IntMkStringer interface {
	// String implements the Stringer interface to render the list as a comma-separated string enclosed
	// in square brackets.
	String() string

	// MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
	MkString(sep string) string

	// MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
	MkString3(before, between, after string) string

	// implements json.Marshaler interface {
	MarshalJSON() ([]byte, error)

	// StringList gets a slice of strings that depicts all the elements.
	StringList() []string
}

IntMkStringer defines an interface for stringer methods on int collections.

type IntSequence added in v0.9.0

type IntSequence interface {
	IntCollection

	// Head gets the first element in the sequence. Head plus Tail include the whole sequence. Head is the opposite of Last.
	Head() int

	// HeadOption gets the first element in the sequence, if possible.
	HeadOption() (int, bool)

	// Last gets the last element in the sequence. Init plus Last include the whole sequence. Last is the opposite of Head.
	Last() int

	// LastOption gets the last element in the sequence, if possible.
	LastOption() (int, bool)
}

IntSequence defines an interface for sequence methods on int.

type IntSet added in v0.3.0

type IntSet struct {
	// contains filtered or unexported fields
}

IntSet is the primary type that represents a set.

func BuildIntSetFromChan added in v0.3.0

func BuildIntSetFromChan(source <-chan int) *IntSet

BuildIntSetFromChan constructs a new IntSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.

func ConvertIntSet added in v0.3.0

func ConvertIntSet(values ...interface{}) (*IntSet, bool)

ConvertIntSet 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. The returned set will contain all the values that were correctly converted.

func NewIntSet added in v0.3.0

func NewIntSet(values ...int) *IntSet

NewIntSet creates and returns a reference to an empty set.

func (*IntSet) Add added in v0.3.0

func (set *IntSet) Add(more ...int) *IntSet

Add returns a new set with all original items and all in `more`. The original set is not altered.

func (*IntSet) Cardinality added in v0.3.0

func (set *IntSet) Cardinality() int

Cardinality returns how many items are currently in the set. This is a synonym for Size.

func (*IntSet) Clone added in v0.3.0

func (set *IntSet) Clone() *IntSet

Clone returns the same set, which is immutable.

func (*IntSet) Contains added in v0.3.0

func (set *IntSet) Contains(i int) bool

Contains determines whether a given item is already in the set, returning true if so.

func (*IntSet) ContainsAll added in v0.3.0

func (set *IntSet) ContainsAll(i ...int) bool

ContainsAll determines whether a given item is already in the set, returning true if so.

func (*IntSet) CountBy added in v0.3.0

func (set *IntSet) CountBy(p func(int) bool) (result int)

CountBy gives the number elements of IntSet that return true for the predicate p.

func (*IntSet) Difference added in v0.3.0

func (set *IntSet) Difference(other *IntSet) *IntSet

Difference returns a new set with items in the current set but not in the other set

func (*IntSet) Equals added in v0.3.0

func (set *IntSet) Equals(other *IntSet) bool

Equals determines whether two sets are equal to each other, returning true if so. 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 (*IntSet) Exists added in v0.3.0

func (set *IntSet) Exists(p func(int) bool) bool

Exists applies a predicate p 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 (*IntSet) Filter added in v0.3.0

func (set *IntSet) Filter(p func(int) bool) *IntSet

Filter returns a new IntSet whose elements return true for the predicate p.

func (*IntSet) Find added in v0.3.0

func (set *IntSet) Find(p func(int) bool) (int, bool)

Find returns the first int that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.

func (*IntSet) FlatMap added in v0.3.0

func (set *IntSet) FlatMap(f func(int) []int) *IntSet

FlatMap returns a new IntSet by transforming every element with a function f that returns zero or more items in a slice. The resulting set may have a different size to the original set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*IntSet) FlatMapToString added in v0.3.0

func (set *IntSet) FlatMapToString(f func(int) []string) []string

FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*IntSet) Fold added in v0.9.0

func (set *IntSet) Fold(initial int, fn func(int, int) int) int

Fold aggregates all the values in the set using a supplied function, starting from some initial value.

func (*IntSet) Forall added in v0.3.0

func (set *IntSet) Forall(p func(int) bool) bool

Forall applies a predicate function p 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 (*IntSet) Foreach added in v0.3.0

func (set *IntSet) Foreach(f func(int))

Foreach iterates over intSet and executes the function f against each element.

func (*IntSet) GobDecode added in v0.3.0

func (set *IntSet) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this set type. You must register int with the 'gob' package before this method is used.

func (IntSet) GobEncode added in v0.3.0

func (set IntSet) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register int with the 'gob' package before this method is used.

func (*IntSet) Intersect added in v0.3.0

func (set *IntSet) Intersect(other *IntSet) *IntSet

Intersect returns a new set with items that exist only in both sets.

func (*IntSet) IsEmpty added in v0.3.0

func (set *IntSet) IsEmpty() bool

IsEmpty returns true if the set is empty.

func (*IntSet) IsSequence added in v0.3.0

func (set *IntSet) IsSequence() bool

IsSequence returns true for lists and queues.

func (*IntSet) IsSet added in v0.3.0

func (set *IntSet) IsSet() bool

IsSet returns false for lists or queues.

func (*IntSet) IsSubset added in v0.3.0

func (set *IntSet) IsSubset(other *IntSet) bool

IsSubset determines whether every item in the other set is in this set, returning true if so.

func (*IntSet) IsSuperset added in v0.3.0

func (set *IntSet) IsSuperset(other *IntSet) bool

IsSuperset determines whether every item of this set is in the other set, returning true if so.

func (*IntSet) Map added in v0.3.0

func (set *IntSet) Map(f func(int) int) *IntSet

Map returns a new IntSet by transforming every element with a function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*IntSet) MapToString added in v0.3.0

func (set *IntSet) MapToString(f func(int) string) []string

MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*IntSet) MarshalJSON added in v0.3.0

func (set *IntSet) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this set type.

func (*IntSet) Max added in v0.3.0

func (set *IntSet) Max() (result int)

Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.

func (*IntSet) MaxBy added in v0.3.0

func (set *IntSet) MaxBy(less func(int, int) bool) int

MaxBy returns an element of IntSet 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 (*IntSet) Min added in v0.3.0

func (set *IntSet) Min() int

Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.

func (*IntSet) MinBy added in v0.3.0

func (set *IntSet) MinBy(less func(int, int) bool) int

MinBy returns an element of IntSet 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 (*IntSet) MkString added in v0.3.0

func (set *IntSet) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*IntSet) MkString3 added in v0.3.0

func (set *IntSet) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*IntSet) NonEmpty added in v0.3.0

func (set *IntSet) NonEmpty() bool

NonEmpty returns true if the set is not empty.

func (*IntSet) Partition added in v0.3.0

func (set *IntSet) Partition(p func(int) bool) (*IntSet, *IntSet)

Partition returns two new intSets 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.

func (*IntSet) Remove added in v0.3.0

func (set *IntSet) Remove(i int) *IntSet

Remove removes a single item from the set. A new set is returned that has all the elements except the removed one.

func (*IntSet) Send added in v0.3.0

func (set *IntSet) Send() <-chan int

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 (*IntSet) Size added in v0.3.0

func (set *IntSet) Size() int

Size returns how many items are currently in the set. This is a synonym for Cardinality.

func (*IntSet) String added in v0.3.0

func (set *IntSet) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*IntSet) StringList added in v0.3.0

func (set *IntSet) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*IntSet) StringMap added in v0.3.0

func (set *IntSet) StringMap() map[string]bool

StringMap renders the set as a map of strings. The value of each item in the set becomes stringified as a key in the resulting map.

func (*IntSet) Sum added in v0.3.0

func (set *IntSet) Sum() int

Sum returns the sum of all the elements in the set.

func (*IntSet) SymmetricDifference added in v0.3.0

func (set *IntSet) SymmetricDifference(other *IntSet) *IntSet

SymmetricDifference returns a new set with items in the current set or the other set but not in both.

func (*IntSet) ToInterfaceSlice added in v0.3.0

func (set *IntSet) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.

func (*IntSet) ToList added in v0.3.0

func (set *IntSet) ToList() *IntList

ToList returns the elements of the set as a list. The returned list is a shallow copy; the set is not altered.

func (*IntSet) ToSet added in v0.3.0

func (set *IntSet) ToSet() *IntSet

ToSet returns the set; this is an identity operation in this case.

func (*IntSet) ToSlice added in v0.3.0

func (set *IntSet) ToSlice() []int

ToSlice returns the elements of the current set as a slice.

func (*IntSet) Union added in v0.3.0

func (set *IntSet) Union(other *IntSet) *IntSet

Union returns a new set with all items in both sets.

func (*IntSet) UnmarshalJSON added in v0.3.0

func (set *IntSet) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this set type.

type IntSizer added in v0.3.0

type IntSizer interface {
	// IsEmpty tests whether IntCollection is empty.
	IsEmpty() bool

	// NonEmpty tests whether IntCollection is empty.
	NonEmpty() bool

	// Size returns the number of items in the list - an alias of Len().
	Size() int
}

IntSizer defines an interface for sizing methods on int collections.

type IntStringMap added in v0.3.0

type IntStringMap struct {
	// contains filtered or unexported fields
}

IntStringMap is the primary type that represents a thread-safe map

func NewIntStringMap added in v0.3.0

func NewIntStringMap(kv ...IntStringTuple) *IntStringMap

NewIntStringMap creates and returns a reference to a map, optionally containing some items.

func NewIntStringMap1 added in v0.3.0

func NewIntStringMap1(k int, v string) *IntStringMap

NewIntStringMap1 creates and returns a reference to a map containing one item.

func (*IntStringMap) Clone added in v0.3.0

func (mm *IntStringMap) Clone() *IntStringMap

Clone returns the same map, which is immutable.

func (*IntStringMap) ContainsAllKeys added in v0.3.0

func (mm *IntStringMap) ContainsAllKeys(kk ...int) bool

ContainsAllKeys determines if the given items are all in the map.

func (*IntStringMap) ContainsKey added in v0.3.0

func (mm *IntStringMap) ContainsKey(k int) bool

ContainsKey determines if a given item is already in the map.

func (*IntStringMap) Equals added in v0.3.0

func (mm *IntStringMap) Equals(other *IntStringMap) bool

Equals determines if two maps 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 maps to be equal.

func (*IntStringMap) Exists added in v0.3.0

func (mm *IntStringMap) Exists(p func(int, string) bool) bool

Exists applies the predicate p 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 (*IntStringMap) Filter added in v0.3.0

func (mm *IntStringMap) Filter(p func(int, string) bool) *IntStringMap

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*IntStringMap) Find added in v0.3.0

func (mm *IntStringMap) Find(p func(int, string) bool) (IntStringTuple, bool)

Find returns the first string that returns true for the predicate p. False is returned if none match.

func (*IntStringMap) FlatMap added in v0.3.0

func (mm *IntStringMap) FlatMap(f func(int, string) []IntStringTuple) *IntStringMap

FlatMap returns a new StringMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*IntStringMap) Forall added in v0.3.0

func (mm *IntStringMap) Forall(f func(int, string) bool) bool

Forall applies the predicate p 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 (*IntStringMap) Foreach added in v0.3.0

func (mm *IntStringMap) Foreach(f func(int, string))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*IntStringMap) Get added in v0.3.0

func (mm *IntStringMap) Get(k int) (string, bool)

Get returns one of the items in the map, if present.

func (*IntStringMap) GobDecode added in v0.3.0

func (mm *IntStringMap) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register string with the 'gob' package before this method is used.

func (*IntStringMap) GobEncode added in v0.3.0

func (mm *IntStringMap) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register string with the 'gob' package before this method is used.

func (*IntStringMap) IsEmpty added in v0.3.0

func (mm *IntStringMap) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*IntStringMap) Keys added in v0.3.0

func (mm *IntStringMap) Keys() collection.IntList

Keys returns the keys of the current map as a slice.

func (*IntStringMap) Map added in v0.3.0

func (mm *IntStringMap) Map(f func(int, string) (int, string)) *IntStringMap

Map returns a new StringMap by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*IntStringMap) MkString added in v0.3.0

func (mm *IntStringMap) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*IntStringMap) MkString4 added in v0.7.0

func (mm *IntStringMap) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*IntStringMap) NonEmpty added in v0.3.0

func (mm *IntStringMap) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*IntStringMap) OrderedSlice added in v0.6.0

func (mm *IntStringMap) OrderedSlice(keys collection.IntList) IntStringTuples

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*IntStringMap) Partition added in v0.3.0

func (mm *IntStringMap) Partition(p func(int, string) bool) (matching *IntStringMap, others *IntStringMap)

Partition applies the predicate p 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.

func (*IntStringMap) Put added in v0.3.0

func (mm *IntStringMap) Put(k int, v string) *IntStringMap

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*IntStringMap) Size added in v0.3.0

func (mm *IntStringMap) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*IntStringMap) String added in v0.3.0

func (mm *IntStringMap) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*IntStringMap) ToSlice added in v0.3.0

func (mm *IntStringMap) ToSlice() IntStringTuples

ToSlice returns the key/value pairs as a slice

func (*IntStringMap) Values added in v0.3.0

func (mm *IntStringMap) Values() collection.StringList

Values returns the values of the current map as a slice.

type IntStringTuple added in v0.3.0

type IntStringTuple struct {
	Key int
	Val string
}

IntStringTuple represents a key/value pair.

func (IntStringTuple) MarshalJSON added in v0.6.0

func (t IntStringTuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (IntStringTuple) UnmarshalJSON added in v0.6.0

func (t IntStringTuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type IntStringTuples added in v0.3.0

type IntStringTuples []IntStringTuple

IntStringTuples can be used as a builder for unmodifiable maps.

func IntStringZip added in v0.3.0

func IntStringZip(keys ...int) IntStringTuples

IntStringZip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewIntStringMap constructor function.

func (IntStringTuples) Append1 added in v0.3.0

func (ts IntStringTuples) Append1(k int, v string) IntStringTuples

Append1 adds one item.

func (IntStringTuples) Append2 added in v0.3.0

func (ts IntStringTuples) Append2(k1 int, v1 string, k2 int, v2 string) IntStringTuples

Append2 adds two items.

func (IntStringTuples) Append3 added in v0.3.0

func (ts IntStringTuples) Append3(k1 int, v1 string, k2 int, v2 string, k3 int, v3 string) IntStringTuples

Append3 adds three items.

func (IntStringTuples) MkString added in v0.6.0

func (ts IntStringTuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (IntStringTuples) MkString4 added in v0.7.0

func (ts IntStringTuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (IntStringTuples) String added in v0.6.0

func (ts IntStringTuples) String() string

func (IntStringTuples) ToMap added in v0.6.0

func (ts IntStringTuples) ToMap() *IntStringMap

ToMap converts the tuples to a map.

func (IntStringTuples) Values added in v0.3.0

func (ts IntStringTuples) Values(values ...string) IntStringTuples

Values sets the values in a tuple slice. Use this with IntStringZip.

type StringAnyMap added in v0.4.0

type StringAnyMap struct {
	// contains filtered or unexported fields
}

StringAnyMap is the primary type that represents a thread-safe map

func NewStringAnyMap added in v0.4.0

func NewStringAnyMap(kv ...StringAnyTuple) *StringAnyMap

NewStringAnyMap creates and returns a reference to a map, optionally containing some items.

func NewStringAnyMap1 added in v0.4.0

func NewStringAnyMap1(k string, v interface{}) *StringAnyMap

NewStringAnyMap1 creates and returns a reference to a map containing one item.

func (*StringAnyMap) Clone added in v0.4.0

func (mm *StringAnyMap) Clone() *StringAnyMap

Clone returns the same map, which is immutable.

func (*StringAnyMap) ContainsAllKeys added in v0.4.0

func (mm *StringAnyMap) ContainsAllKeys(kk ...string) bool

ContainsAllKeys determines if the given items are all in the map.

func (*StringAnyMap) ContainsKey added in v0.4.0

func (mm *StringAnyMap) ContainsKey(k string) bool

ContainsKey determines if a given item is already in the map.

func (*StringAnyMap) Equals added in v0.6.0

func (mm *StringAnyMap) Equals(other *StringAnyMap) bool

Equals determines if two maps 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 maps to be equal.

func (*StringAnyMap) Exists added in v0.4.0

func (mm *StringAnyMap) Exists(p func(string, interface{}) bool) bool

Exists applies the predicate p 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 added in v0.4.0

func (mm *StringAnyMap) Filter(p func(string, interface{}) bool) *StringAnyMap

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*StringAnyMap) Find added in v0.4.0

func (mm *StringAnyMap) Find(p func(string, interface{}) bool) (StringAnyTuple, bool)

Find returns the first interface{} that returns true for the predicate p. False is returned if none match.

func (*StringAnyMap) FlatMap added in v0.4.0

func (mm *StringAnyMap) FlatMap(f func(string, interface{}) []StringAnyTuple) *StringAnyMap

FlatMap returns a new AnyMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringAnyMap) Forall added in v0.4.0

func (mm *StringAnyMap) Forall(f func(string, interface{}) bool) bool

Forall applies the predicate p 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 added in v0.4.0

func (mm *StringAnyMap) Foreach(f func(string, interface{}))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*StringAnyMap) Get added in v0.4.0

func (mm *StringAnyMap) Get(k string) (interface{}, bool)

Get returns one of the items in the map, if present.

func (*StringAnyMap) GobDecode added in v0.6.0

func (mm *StringAnyMap) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register interface{} with the 'gob' package before this method is used.

func (*StringAnyMap) GobEncode added in v0.6.0

func (mm *StringAnyMap) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register interface{} with the 'gob' package before this method is used.

func (*StringAnyMap) IsEmpty added in v0.4.0

func (mm *StringAnyMap) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*StringAnyMap) Keys added in v0.4.0

func (mm *StringAnyMap) Keys() collection.StringList

Keys returns the keys of the current map as a slice.

func (*StringAnyMap) Map added in v0.4.0

func (mm *StringAnyMap) Map(f func(string, interface{}) (string, interface{})) *StringAnyMap

Map returns a new AnyMap by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringAnyMap) MarshalJSON added in v0.6.0

func (mm *StringAnyMap) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this map type.

func (*StringAnyMap) MkString added in v0.6.0

func (mm *StringAnyMap) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*StringAnyMap) MkString4 added in v0.7.0

func (mm *StringAnyMap) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*StringAnyMap) NonEmpty added in v0.4.0

func (mm *StringAnyMap) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*StringAnyMap) OrderedSlice added in v0.6.0

func (mm *StringAnyMap) OrderedSlice(keys collection.StringList) StringAnyTuples

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*StringAnyMap) Partition added in v0.4.0

func (mm *StringAnyMap) Partition(p func(string, interface{}) bool) (matching *StringAnyMap, others *StringAnyMap)

Partition applies the predicate p 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.

func (*StringAnyMap) Put added in v0.4.0

func (mm *StringAnyMap) Put(k string, v interface{}) *StringAnyMap

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*StringAnyMap) Size added in v0.4.0

func (mm *StringAnyMap) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*StringAnyMap) String added in v0.6.0

func (mm *StringAnyMap) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*StringAnyMap) ToSlice added in v0.4.0

func (mm *StringAnyMap) ToSlice() StringAnyTuples

ToSlice returns the key/value pairs as a slice

func (*StringAnyMap) UnmarshalJSON added in v0.6.0

func (mm *StringAnyMap) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this map type.

func (*StringAnyMap) Values added in v0.4.0

func (mm *StringAnyMap) Values() collection.AnyList

Values returns the values of the current map as a slice.

type StringAnyTuple added in v0.4.0

type StringAnyTuple struct {
	Key string
	Val interface{}
}

StringAnyTuple represents a key/value pair.

func (StringAnyTuple) MarshalJSON added in v0.6.0

func (t StringAnyTuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (StringAnyTuple) UnmarshalJSON added in v0.6.0

func (t StringAnyTuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type StringAnyTuples added in v0.4.0

type StringAnyTuples []StringAnyTuple

StringAnyTuples can be used as a builder for unmodifiable maps.

func StringAnyZip added in v0.4.0

func StringAnyZip(keys ...string) StringAnyTuples

StringAnyZip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewStringAnyMap constructor function.

func (StringAnyTuples) Append1 added in v0.4.0

func (ts StringAnyTuples) Append1(k string, v interface{}) StringAnyTuples

Append1 adds one item.

func (StringAnyTuples) Append2 added in v0.4.0

func (ts StringAnyTuples) Append2(k1 string, v1 interface{}, k2 string, v2 interface{}) StringAnyTuples

Append2 adds two items.

func (StringAnyTuples) Append3 added in v0.4.0

func (ts StringAnyTuples) Append3(k1 string, v1 interface{}, k2 string, v2 interface{}, k3 string, v3 interface{}) StringAnyTuples

Append3 adds three items.

func (StringAnyTuples) MkString added in v0.6.0

func (ts StringAnyTuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (StringAnyTuples) MkString4 added in v0.7.0

func (ts StringAnyTuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (StringAnyTuples) String added in v0.6.0

func (ts StringAnyTuples) String() string

func (StringAnyTuples) ToMap added in v0.6.0

func (ts StringAnyTuples) ToMap() *StringAnyMap

ToMap converts the tuples to a map.

func (StringAnyTuples) Values added in v0.4.0

func (ts StringAnyTuples) Values(values ...interface{}) StringAnyTuples

Values sets the values in a tuple slice. Use this with StringAnyZip.

type StringCollection added in v0.3.0

type StringCollection interface {
	StringSizer
	StringMkStringer

	// IsSequence returns true for lists and queues.
	IsSequence() bool

	// IsSet returns false for lists and queues.
	IsSet() bool

	// ToSlice returns a shallow copy as a plain slice.
	ToSlice() []string

	// ToInterfaceSlice returns a shallow copy as a slice of arbitrary type.
	ToInterfaceSlice() []interface{}

	// Exists verifies that one or more elements of StringCollection return true for the predicate p.
	Exists(p func(string) bool) bool

	// Forall verifies that all elements of StringCollection return true for the predicate p.
	Forall(p func(string) bool) bool

	// Foreach iterates over StringCollection and executes the function f against each element.
	Foreach(f func(string))

	// Find returns the first string that returns true for the predicate p.
	// False is returned if none match.
	Find(p func(string) bool) (string, bool)

	// MapToInt returns a new []int by transforming every element with function f.
	// The resulting slice is the same size as the collection. The collection is not modified.
	MapToInt(f func(string) int) []int

	// FlatMapInt returns a new []int by transforming every element with function f
	// that returns zero or more items in a slice. The resulting slice may have a different size to the
	// collection. The collection is not modified.
	FlatMapToInt(f func(string) []int) []int

	// Send returns a channel that will send all the elements in order. Can be used with the plumbing code, for example.
	// A goroutine is created to send the elements; this only terminates when all the elements have been consumed
	Send() <-chan string

	// CountBy gives the number elements of StringCollection that return true for the predicate p.
	CountBy(p func(string) bool) int

	// Contains determines whether a given item is already in the collection, returning true if so.
	Contains(v string) bool

	// ContainsAll determines whether the given items are all in the collection, returning true if so.
	ContainsAll(v ...string) bool

	// MinBy returns an element of StringCollection 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.
	MinBy(less func(string, string) bool) string

	// MaxBy returns an element of StringCollection 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.
	MaxBy(less func(string, string) bool) string

	// Fold aggregates all the values in the collection using a supplied function, starting from some initial value.
	Fold(initial string, fn func(string, string) string) string
}

StringCollection defines an interface for common collection methods on string.

type StringIntMap added in v0.3.0

type StringIntMap struct {
	// contains filtered or unexported fields
}

StringIntMap is the primary type that represents a thread-safe map

func NewStringIntMap added in v0.3.0

func NewStringIntMap(kv ...StringIntTuple) *StringIntMap

NewStringIntMap creates and returns a reference to a map, optionally containing some items.

func NewStringIntMap1 added in v0.3.0

func NewStringIntMap1(k string, v int) *StringIntMap

NewStringIntMap1 creates and returns a reference to a map containing one item.

func (*StringIntMap) Clone added in v0.3.0

func (mm *StringIntMap) Clone() *StringIntMap

Clone returns the same map, which is immutable.

func (*StringIntMap) ContainsAllKeys added in v0.3.0

func (mm *StringIntMap) ContainsAllKeys(kk ...string) bool

ContainsAllKeys determines if the given items are all in the map.

func (*StringIntMap) ContainsKey added in v0.3.0

func (mm *StringIntMap) ContainsKey(k string) bool

ContainsKey determines if a given item is already in the map.

func (*StringIntMap) Equals added in v0.3.0

func (mm *StringIntMap) Equals(other *StringIntMap) bool

Equals determines if two maps 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 maps to be equal.

func (*StringIntMap) Exists added in v0.3.0

func (mm *StringIntMap) Exists(p func(string, int) bool) bool

Exists applies the predicate p 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 (*StringIntMap) Filter added in v0.3.0

func (mm *StringIntMap) Filter(p func(string, int) bool) *StringIntMap

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*StringIntMap) Find added in v0.3.0

func (mm *StringIntMap) Find(p func(string, int) bool) (StringIntTuple, bool)

Find returns the first int that returns true for the predicate p. False is returned if none match.

func (*StringIntMap) FlatMap added in v0.3.0

func (mm *StringIntMap) FlatMap(f func(string, int) []StringIntTuple) *StringIntMap

FlatMap returns a new IntMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringIntMap) Forall added in v0.3.0

func (mm *StringIntMap) Forall(f func(string, int) bool) bool

Forall applies the predicate p 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 (*StringIntMap) Foreach added in v0.3.0

func (mm *StringIntMap) Foreach(f func(string, int))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*StringIntMap) Get added in v0.3.0

func (mm *StringIntMap) Get(k string) (int, bool)

Get returns one of the items in the map, if present.

func (*StringIntMap) GobDecode added in v0.3.0

func (mm *StringIntMap) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register int with the 'gob' package before this method is used.

func (*StringIntMap) GobEncode added in v0.3.0

func (mm *StringIntMap) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register int with the 'gob' package before this method is used.

func (*StringIntMap) IsEmpty added in v0.3.0

func (mm *StringIntMap) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*StringIntMap) Keys added in v0.3.0

func (mm *StringIntMap) Keys() collection.StringList

Keys returns the keys of the current map as a slice.

func (*StringIntMap) Map added in v0.3.0

func (mm *StringIntMap) Map(f func(string, int) (string, int)) *StringIntMap

Map returns a new IntMap by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringIntMap) MarshalJSON added in v0.3.0

func (mm *StringIntMap) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this map type.

func (*StringIntMap) MkString added in v0.3.0

func (mm *StringIntMap) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*StringIntMap) MkString4 added in v0.7.0

func (mm *StringIntMap) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*StringIntMap) NonEmpty added in v0.3.0

func (mm *StringIntMap) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*StringIntMap) OrderedSlice added in v0.6.0

func (mm *StringIntMap) OrderedSlice(keys collection.StringList) StringIntTuples

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*StringIntMap) Partition added in v0.3.0

func (mm *StringIntMap) Partition(p func(string, int) bool) (matching *StringIntMap, others *StringIntMap)

Partition applies the predicate p 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.

func (*StringIntMap) Put added in v0.3.0

func (mm *StringIntMap) Put(k string, v int) *StringIntMap

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*StringIntMap) Size added in v0.3.0

func (mm *StringIntMap) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*StringIntMap) String added in v0.3.0

func (mm *StringIntMap) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*StringIntMap) ToSlice added in v0.3.0

func (mm *StringIntMap) ToSlice() StringIntTuples

ToSlice returns the key/value pairs as a slice

func (*StringIntMap) UnmarshalJSON added in v0.3.0

func (mm *StringIntMap) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this map type.

func (*StringIntMap) Values added in v0.3.0

func (mm *StringIntMap) Values() collection.IntList

Values returns the values of the current map as a slice.

type StringIntTuple added in v0.3.0

type StringIntTuple struct {
	Key string
	Val int
}

StringIntTuple represents a key/value pair.

func (StringIntTuple) MarshalJSON added in v0.6.0

func (t StringIntTuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (StringIntTuple) UnmarshalJSON added in v0.6.0

func (t StringIntTuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type StringIntTuples added in v0.3.0

type StringIntTuples []StringIntTuple

StringIntTuples can be used as a builder for unmodifiable maps.

func StringIntZip added in v0.3.0

func StringIntZip(keys ...string) StringIntTuples

StringIntZip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewStringIntMap constructor function.

func (StringIntTuples) Append1 added in v0.3.0

func (ts StringIntTuples) Append1(k string, v int) StringIntTuples

Append1 adds one item.

func (StringIntTuples) Append2 added in v0.3.0

func (ts StringIntTuples) Append2(k1 string, v1 int, k2 string, v2 int) StringIntTuples

Append2 adds two items.

func (StringIntTuples) Append3 added in v0.3.0

func (ts StringIntTuples) Append3(k1 string, v1 int, k2 string, v2 int, k3 string, v3 int) StringIntTuples

Append3 adds three items.

func (StringIntTuples) MkString added in v0.6.0

func (ts StringIntTuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (StringIntTuples) MkString4 added in v0.7.0

func (ts StringIntTuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (StringIntTuples) String added in v0.6.0

func (ts StringIntTuples) String() string

func (StringIntTuples) ToMap added in v0.6.0

func (ts StringIntTuples) ToMap() *StringIntMap

ToMap converts the tuples to a map.

func (StringIntTuples) Values added in v0.3.0

func (ts StringIntTuples) Values(values ...int) StringIntTuples

Values sets the values in a tuple slice. Use this with StringIntZip.

type StringList added in v0.3.0

type StringList struct {
	// contains filtered or unexported fields
}

StringList contains a slice of type string. It is designed to be immutable - ideal for race-free reference lists etc. It encapsulates the slice and provides methods to access it. Importantly, *none of its methods ever mutate a list*; they merely return new lists where required.

List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq

func BuildStringListFromChan added in v0.3.0

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 added in v0.3.0

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 added in v0.3.0

func NewStringList(values ...string) *StringList

NewStringList constructs a new list containing the supplied values, if any.

func (*StringList) Append added in v0.3.0

func (list *StringList) Append(more ...string) *StringList

Append returns a new list with all original items and all in `more`; they retain their order. The original list is not altered.

func (*StringList) Clone added in v0.3.0

func (list *StringList) Clone() *StringList

Clone returns the same list, which is immutable.

func (*StringList) Contains added in v0.3.0

func (list *StringList) Contains(v string) bool

Contains determines whether a given item is already in the list, returning true if so.

func (*StringList) ContainsAll added in v0.3.0

func (list *StringList) ContainsAll(i ...string) bool

ContainsAll determines whether the given items are all in the list, returning true if so. This is potentially a slow method and should only be used rarely.

func (*StringList) CountBy added in v0.3.0

func (list *StringList) CountBy(p func(string) bool) (result int)

CountBy gives the number elements of StringList that return true for the predicate p.

func (*StringList) DistinctBy added in v0.3.0

func (list *StringList) DistinctBy(equal func(string, string) bool) *StringList

DistinctBy returns a new StringList whose elements are unique, where equality is defined by the equal function.

func (*StringList) Drop added in v0.3.0

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 added in v0.3.0

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 added in v0.3.0

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 elements are added.

func (*StringList) Equals added in v0.3.0

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. Nil lists are considered to be empty.

func (*StringList) Exists added in v0.3.0

func (list *StringList) Exists(p func(string) bool) bool

Exists verifies that one or more elements of StringList return true for the predicate p.

func (*StringList) Filter added in v0.3.0

func (list *StringList) Filter(p func(string) bool) *StringList

Filter returns a new StringList whose elements return true for predicate p.

func (*StringList) Find added in v0.3.0

func (list *StringList) Find(p func(string) bool) (string, bool)

Find returns the first string that returns true for predicate p. False is returned if none match.

func (*StringList) FlatMap added in v0.3.0

func (list *StringList) FlatMap(f func(string) []string) *StringList

FlatMap returns a new StringList by transforming every element with function f that returns zero or more items in a slice. The resulting list may have a different size to the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringList) FlatMapToInt added in v0.3.0

func (list *StringList) FlatMapToInt(f func(string) []int) []int

FlatMapToInt returns a new []int by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringList) Fold added in v0.9.0

func (list *StringList) Fold(initial string, fn func(string, string) string) string

Fold aggregates all the values in the list using a supplied function, starting from some initial value.

func (*StringList) Forall added in v0.3.0

func (list *StringList) Forall(p func(string) bool) bool

Forall verifies that all elements of StringList return true for the predicate p.

func (*StringList) Foreach added in v0.3.0

func (list *StringList) Foreach(f func(string))

Foreach iterates over StringList and executes function f against each element. The function receives copies that do not alter the list elements when they are changed.

func (*StringList) Get added in v0.3.0

func (list *StringList) Get(i int) string

Get gets the specified element in the list. Panics if the index is out of range or the list is nil.

func (*StringList) GobDecode added in v0.3.0

func (list *StringList) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this list type. You must register string with the 'gob' package before this method is used.

func (StringList) GobEncode added in v0.3.0

func (list StringList) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register string with the 'gob' package before this method is used.

func (*StringList) Head added in v0.3.0

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 or nil.

func (*StringList) HeadOption added in v0.3.0

func (list *StringList) HeadOption() (string, bool)

HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.

func (*StringList) IndexWhere added in v0.3.0

func (list *StringList) IndexWhere(p func(string) bool) int

IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.

func (*StringList) IndexWhere2 added in v0.3.0

func (list *StringList) IndexWhere2(p func(string) bool, from int) int

IndexWhere2 finds the index of the first element satisfying predicate p at or after some start index. If none exists, -1 is returned.

func (*StringList) Init added in v0.3.0

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 or nil.

func (*StringList) IsEmpty added in v0.3.0

func (list *StringList) IsEmpty() bool

IsEmpty tests whether StringList is empty.

func (*StringList) IsSequence added in v0.3.0

func (list *StringList) IsSequence() bool

IsSequence returns true for lists and queues.

func (*StringList) IsSet added in v0.3.0

func (list *StringList) IsSet() bool

IsSet returns false for lists or queues.

func (*StringList) Last added in v0.3.0

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 or nil.

func (*StringList) LastIndexWhere added in v0.3.0

func (list *StringList) LastIndexWhere(p func(string) bool) int

LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.

func (*StringList) LastIndexWhere2 added in v0.3.0

func (list *StringList) LastIndexWhere2(p func(string) bool, before int) int

LastIndexWhere2 finds the index of the last element satisfying predicate p at or before some start index. If none exists, -1 is returned.

func (*StringList) LastOption added in v0.3.0

func (list *StringList) LastOption() (string, bool)

LastOption gets the last element in the list, if possible. Otherwise returns the zero value.

func (*StringList) Len added in v0.3.0

func (list *StringList) Len() int

Len returns the number of items in the list - an alias of Size().

func (*StringList) Map added in v0.3.0

func (list *StringList) Map(f func(string) string) *StringList

Map returns a new StringList by transforming every element with function f. The resulting list is the same size as the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringList) MapToInt added in v0.3.0

func (list *StringList) MapToInt(f func(string) int) []int

MapToInt returns a new []int by transforming every element with function f. The resulting slice is the same size as the list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (StringList) MarshalJSON added in v0.3.0

func (list StringList) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this list type.

func (*StringList) MaxBy added in v0.3.0

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) MinBy added in v0.3.0

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) MkString added in v0.3.0

func (list *StringList) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*StringList) MkString3 added in v0.3.0

func (list *StringList) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*StringList) NonEmpty added in v0.3.0

func (list *StringList) NonEmpty() bool

NonEmpty tests whether StringList is empty.

func (*StringList) Partition added in v0.3.0

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.

func (*StringList) Reverse added in v0.3.0

func (list *StringList) Reverse() *StringList

Reverse returns a copy of StringList with all elements in the reverse order.

func (*StringList) Send added in v0.3.0

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. The channel will be closed when all the elements have been sent.

func (*StringList) Shuffle added in v0.3.0

func (list *StringList) Shuffle() *StringList

Shuffle returns a shuffled copy of StringList, using a version of the Fisher-Yates shuffle.

func (*StringList) Size added in v0.3.0

func (list *StringList) Size() int

Size returns the number of items in the list - an alias of Len().

func (*StringList) SortBy added in v0.3.0

func (list *StringList) SortBy(less func(i, j string) bool) *StringList

SortBy returns a new list in which the elements are sorted by a specified ordering.

func (*StringList) Sorted added in v0.5.0

func (list *StringList) Sorted() *StringList

Sorted returns a new copy of the list in which the elements are sorted by their natural ordering.

func (*StringList) StableSortBy added in v0.3.0

func (list *StringList) StableSortBy(less func(i, j string) bool) *StringList

StableSortBy returns a new list in which the elements are sorted by a specified ordering. The algorithm keeps the original order of equal elements.

func (*StringList) String added in v0.3.0

func (list *StringList) String() string

String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.

func (*StringList) StringList added in v0.3.0

func (list *StringList) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*StringList) Tail added in v0.3.0

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 or nil.

func (*StringList) Take added in v0.3.0

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 or equal to the size of the list, the whole original list is returned.

func (*StringList) TakeLast added in v0.3.0

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 or equal to the size of the list, the whole original list is returned.

func (*StringList) TakeWhile added in v0.3.0

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 elements are excluded.

func (*StringList) ToInterfaceSlice added in v0.3.0

func (list *StringList) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.

func (*StringList) ToList added in v0.3.0

func (list *StringList) ToList() *StringList

ToList returns the elements of the list as a list, which is an identity operation in this case.

func (*StringList) ToSet added in v0.3.0

func (list *StringList) ToSet() *StringSet

ToSet returns the elements of the list as a set. The returned set is a shallow copy; the list is not altered.

func (*StringList) ToSlice added in v0.3.0

func (list *StringList) ToSlice() []string

ToSlice returns the elements of the current list as a slice.

func (*StringList) UnmarshalJSON added in v0.3.0

func (list *StringList) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this list type.

type StringMkStringer added in v0.3.0

type StringMkStringer interface {
	// String implements the Stringer interface to render the list as a comma-separated string enclosed
	// in square brackets.
	String() string

	// MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
	MkString(sep string) string

	// MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
	MkString3(before, between, after string) string

	// implements json.Marshaler interface {
	MarshalJSON() ([]byte, error)

	// StringList gets a slice of strings that depicts all the elements.
	StringList() []string
}

StringMkStringer defines an interface for stringer methods on string collections.

type StringSequence added in v0.9.0

type StringSequence interface {
	StringCollection

	// Head gets the first element in the sequence. Head plus Tail include the whole sequence. Head is the opposite of Last.
	Head() string

	// HeadOption gets the first element in the sequence, if possible.
	HeadOption() (string, bool)

	// Last gets the last element in the sequence. Init plus Last include the whole sequence. Last is the opposite of Head.
	Last() string

	// LastOption gets the last element in the sequence, if possible.
	LastOption() (string, bool)
}

StringSequence defines an interface for sequence methods on string.

type StringSet added in v0.3.0

type StringSet struct {
	// contains filtered or unexported fields
}

StringSet is the primary type that represents a set.

func BuildStringSetFromChan added in v0.3.0

func BuildStringSetFromChan(source <-chan string) *StringSet

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 added in v0.3.0

func ConvertStringSet(values ...interface{}) (*StringSet, bool)

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. The returned set will contain all the values that were correctly converted.

func NewStringSet added in v0.3.0

func NewStringSet(values ...string) *StringSet

NewStringSet creates and returns a reference to an empty set.

func (*StringSet) Add added in v0.3.0

func (set *StringSet) Add(more ...string) *StringSet

Add returns a new set with all original items and all in `more`. The original set is not altered.

func (*StringSet) Cardinality added in v0.3.0

func (set *StringSet) Cardinality() int

Cardinality returns how many items are currently in the set. This is a synonym for Size.

func (*StringSet) Clone added in v0.3.0

func (set *StringSet) Clone() *StringSet

Clone returns the same set, which is immutable.

func (*StringSet) Contains added in v0.3.0

func (set *StringSet) Contains(i string) bool

Contains determines whether a given item is already in the set, returning true if so.

func (*StringSet) ContainsAll added in v0.3.0

func (set *StringSet) ContainsAll(i ...string) bool

ContainsAll determines whether a given item is already in the set, returning true if so.

func (*StringSet) CountBy added in v0.3.0

func (set *StringSet) CountBy(p func(string) bool) (result int)

CountBy gives the number elements of StringSet that return true for the predicate p.

func (*StringSet) Difference added in v0.3.0

func (set *StringSet) Difference(other *StringSet) *StringSet

Difference returns a new set with items in the current set but not in the other set

func (*StringSet) Equals added in v0.3.0

func (set *StringSet) Equals(other *StringSet) bool

Equals determines whether two sets are equal to each other, returning true if so. 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 added in v0.3.0

func (set *StringSet) Exists(p func(string) bool) bool

Exists applies a predicate p 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 added in v0.3.0

func (set *StringSet) Filter(p func(string) bool) *StringSet

Filter returns a new StringSet whose elements return true for the predicate p.

func (*StringSet) Find added in v0.3.0

func (set *StringSet) Find(p func(string) bool) (string, bool)

Find returns the first string that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.

func (*StringSet) FlatMap added in v0.3.0

func (set *StringSet) FlatMap(f func(string) []string) *StringSet

FlatMap returns a new StringSet by transforming every element with a function f that returns zero or more items in a slice. The resulting set may have a different size to the original set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringSet) FlatMapToInt added in v0.3.0

func (set *StringSet) FlatMapToInt(f func(string) []int) []int

FlatMapToInt returns a new []int by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringSet) Fold added in v0.9.0

func (set *StringSet) Fold(initial string, fn func(string, string) string) string

Fold aggregates all the values in the set using a supplied function, starting from some initial value.

func (*StringSet) Forall added in v0.3.0

func (set *StringSet) Forall(p func(string) bool) bool

Forall applies a predicate function p 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 added in v0.3.0

func (set *StringSet) Foreach(f func(string))

Foreach iterates over stringSet and executes the function f against each element.

func (*StringSet) GobDecode added in v0.3.0

func (set *StringSet) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this set type. You must register string with the 'gob' package before this method is used.

func (StringSet) GobEncode added in v0.3.0

func (set StringSet) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register string with the 'gob' package before this method is used.

func (*StringSet) Intersect added in v0.3.0

func (set *StringSet) Intersect(other *StringSet) *StringSet

Intersect returns a new set with items that exist only in both sets.

func (*StringSet) IsEmpty added in v0.3.0

func (set *StringSet) IsEmpty() bool

IsEmpty returns true if the set is empty.

func (*StringSet) IsSequence added in v0.3.0

func (set *StringSet) IsSequence() bool

IsSequence returns true for lists and queues.

func (*StringSet) IsSet added in v0.3.0

func (set *StringSet) IsSet() bool

IsSet returns false for lists or queues.

func (*StringSet) IsSubset added in v0.3.0

func (set *StringSet) IsSubset(other *StringSet) bool

IsSubset determines whether every item in the other set is in this set, returning true if so.

func (*StringSet) IsSuperset added in v0.3.0

func (set *StringSet) IsSuperset(other *StringSet) bool

IsSuperset determines whether every item of this set is in the other set, returning true if so.

func (*StringSet) Map added in v0.3.0

func (set *StringSet) Map(f func(string) string) *StringSet

Map returns a new StringSet by transforming every element with a function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringSet) MapToInt added in v0.3.0

func (set *StringSet) MapToInt(f func(string) int) []int

MapToInt returns a new []int by transforming every element with function f. The resulting slice is the same size as the set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringSet) MarshalJSON added in v0.3.0

func (set *StringSet) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this set type.

func (*StringSet) MaxBy added in v0.3.0

func (set *StringSet) MaxBy(less func(string, string) bool) string

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) MinBy added in v0.3.0

func (set *StringSet) MinBy(less func(string, string) bool) string

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) MkString added in v0.3.0

func (set *StringSet) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*StringSet) MkString3 added in v0.3.0

func (set *StringSet) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*StringSet) NonEmpty added in v0.3.0

func (set *StringSet) NonEmpty() bool

NonEmpty returns true if the set is not empty.

func (*StringSet) Partition added in v0.3.0

func (set *StringSet) Partition(p func(string) bool) (*StringSet, *StringSet)

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.

func (*StringSet) Remove added in v0.3.0

func (set *StringSet) Remove(i string) *StringSet

Remove removes a single item from the set. A new set is returned that has all the elements except the removed one.

func (*StringSet) Send added in v0.3.0

func (set *StringSet) 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 (*StringSet) Size added in v0.3.0

func (set *StringSet) Size() int

Size returns how many items are currently in the set. This is a synonym for Cardinality.

func (*StringSet) String added in v0.3.0

func (set *StringSet) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*StringSet) StringList added in v0.3.0

func (set *StringSet) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*StringSet) StringMap added in v0.3.0

func (set *StringSet) StringMap() map[string]bool

StringMap renders the set as a map of strings. The value of each item in the set becomes stringified as a key in the resulting map.

func (*StringSet) SymmetricDifference added in v0.3.0

func (set *StringSet) SymmetricDifference(other *StringSet) *StringSet

SymmetricDifference returns a new set with items in the current set or the other set but not in both.

func (*StringSet) ToInterfaceSlice added in v0.3.0

func (set *StringSet) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.

func (*StringSet) ToList added in v0.3.0

func (set *StringSet) ToList() *StringList

ToList returns the elements of the set as a list. The returned list is a shallow copy; the set is not altered.

func (*StringSet) ToSet added in v0.3.0

func (set *StringSet) ToSet() *StringSet

ToSet returns the set; this is an identity operation in this case.

func (*StringSet) ToSlice added in v0.3.0

func (set *StringSet) ToSlice() []string

ToSlice returns the elements of the current set as a slice.

func (*StringSet) Union added in v0.3.0

func (set *StringSet) Union(other *StringSet) *StringSet

Union returns a new set with all items in both sets.

func (*StringSet) UnmarshalJSON added in v0.3.0

func (set *StringSet) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this set type.

type StringSizer added in v0.3.0

type StringSizer interface {
	// IsEmpty tests whether StringCollection is empty.
	IsEmpty() bool

	// NonEmpty tests whether StringCollection is empty.
	NonEmpty() bool

	// Size returns the number of items in the list - an alias of Len().
	Size() int
}

StringSizer defines an interface for sizing methods on string collections.

type StringStringMap added in v0.3.0

type StringStringMap struct {
	// contains filtered or unexported fields
}

StringStringMap is the primary type that represents a thread-safe map

func NewStringStringMap added in v0.3.0

func NewStringStringMap(kv ...StringStringTuple) *StringStringMap

NewStringStringMap creates and returns a reference to a map, optionally containing some items.

func NewStringStringMap1 added in v0.3.0

func NewStringStringMap1(k string, v string) *StringStringMap

NewStringStringMap1 creates and returns a reference to a map containing one item.

func (*StringStringMap) Clone added in v0.3.0

func (mm *StringStringMap) Clone() *StringStringMap

Clone returns the same map, which is immutable.

func (*StringStringMap) ContainsAllKeys added in v0.3.0

func (mm *StringStringMap) ContainsAllKeys(kk ...string) bool

ContainsAllKeys determines if the given items are all in the map.

func (*StringStringMap) ContainsKey added in v0.3.0

func (mm *StringStringMap) ContainsKey(k string) bool

ContainsKey determines if a given item is already in the map.

func (*StringStringMap) Equals added in v0.3.0

func (mm *StringStringMap) Equals(other *StringStringMap) bool

Equals determines if two maps 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 maps to be equal.

func (*StringStringMap) Exists added in v0.3.0

func (mm *StringStringMap) Exists(p func(string, string) bool) bool

Exists applies the predicate p 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 (*StringStringMap) Filter added in v0.3.0

func (mm *StringStringMap) Filter(p func(string, string) bool) *StringStringMap

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*StringStringMap) Find added in v0.3.0

func (mm *StringStringMap) Find(p func(string, string) bool) (StringStringTuple, bool)

Find returns the first string that returns true for the predicate p. False is returned if none match.

func (*StringStringMap) FlatMap added in v0.3.0

FlatMap returns a new StringMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringStringMap) Forall added in v0.3.0

func (mm *StringStringMap) Forall(f func(string, string) bool) bool

Forall applies the predicate p 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 (*StringStringMap) Foreach added in v0.3.0

func (mm *StringStringMap) Foreach(f func(string, string))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*StringStringMap) Get added in v0.3.0

func (mm *StringStringMap) Get(k string) (string, bool)

Get returns one of the items in the map, if present.

func (*StringStringMap) GobDecode added in v0.3.0

func (mm *StringStringMap) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register string with the 'gob' package before this method is used.

func (*StringStringMap) GobEncode added in v0.3.0

func (mm *StringStringMap) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register string with the 'gob' package before this method is used.

func (*StringStringMap) IsEmpty added in v0.3.0

func (mm *StringStringMap) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*StringStringMap) Keys added in v0.3.0

Keys returns the keys of the current map as a slice.

func (*StringStringMap) Map added in v0.3.0

func (mm *StringStringMap) Map(f func(string, string) (string, string)) *StringStringMap

Map returns a new StringMap by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringStringMap) MarshalJSON added in v0.3.0

func (mm *StringStringMap) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this map type.

func (*StringStringMap) MkString added in v0.3.0

func (mm *StringStringMap) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*StringStringMap) MkString4 added in v0.7.0

func (mm *StringStringMap) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*StringStringMap) NonEmpty added in v0.3.0

func (mm *StringStringMap) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*StringStringMap) OrderedSlice added in v0.6.0

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*StringStringMap) Partition added in v0.3.0

func (mm *StringStringMap) Partition(p func(string, string) bool) (matching *StringStringMap, others *StringStringMap)

Partition applies the predicate p 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.

func (*StringStringMap) Put added in v0.3.0

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*StringStringMap) Size added in v0.3.0

func (mm *StringStringMap) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*StringStringMap) String added in v0.3.0

func (mm *StringStringMap) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*StringStringMap) ToSlice added in v0.3.0

func (mm *StringStringMap) ToSlice() StringStringTuples

ToSlice returns the key/value pairs as a slice

func (*StringStringMap) UnmarshalJSON added in v0.3.0

func (mm *StringStringMap) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this map type.

func (*StringStringMap) Values added in v0.3.0

func (mm *StringStringMap) Values() collection.StringList

Values returns the values of the current map as a slice.

type StringStringTuple added in v0.3.0

type StringStringTuple struct {
	Key string
	Val string
}

StringStringTuple represents a key/value pair.

func (StringStringTuple) MarshalJSON added in v0.6.0

func (t StringStringTuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (StringStringTuple) UnmarshalJSON added in v0.6.0

func (t StringStringTuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type StringStringTuples added in v0.3.0

type StringStringTuples []StringStringTuple

StringStringTuples can be used as a builder for unmodifiable maps.

func StringStringZip added in v0.3.0

func StringStringZip(keys ...string) StringStringTuples

StringStringZip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewStringStringMap constructor function.

func (StringStringTuples) Append1 added in v0.3.0

Append1 adds one item.

func (StringStringTuples) Append2 added in v0.3.0

func (ts StringStringTuples) Append2(k1 string, v1 string, k2 string, v2 string) StringStringTuples

Append2 adds two items.

func (StringStringTuples) Append3 added in v0.3.0

func (ts StringStringTuples) Append3(k1 string, v1 string, k2 string, v2 string, k3 string, v3 string) StringStringTuples

Append3 adds three items.

func (StringStringTuples) MkString added in v0.6.0

func (ts StringStringTuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (StringStringTuples) MkString4 added in v0.7.0

func (ts StringStringTuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (StringStringTuples) String added in v0.6.0

func (ts StringStringTuples) String() string

func (StringStringTuples) ToMap added in v0.6.0

func (ts StringStringTuples) ToMap() *StringStringMap

ToMap converts the tuples to a map.

func (StringStringTuples) Values added in v0.3.0

func (ts StringStringTuples) Values(values ...string) StringStringTuples

Values sets the values in a tuple slice. Use this with StringStringZip.

type StringUintMap added in v0.3.0

type StringUintMap struct {
	// contains filtered or unexported fields
}

StringUintMap is the primary type that represents a thread-safe map

func NewStringUintMap added in v0.3.0

func NewStringUintMap(kv ...StringUintTuple) *StringUintMap

NewStringUintMap creates and returns a reference to a map, optionally containing some items.

func NewStringUintMap1 added in v0.3.0

func NewStringUintMap1(k string, v uint) *StringUintMap

NewStringUintMap1 creates and returns a reference to a map containing one item.

func (*StringUintMap) Clone added in v0.3.0

func (mm *StringUintMap) Clone() *StringUintMap

Clone returns the same map, which is immutable.

func (*StringUintMap) ContainsAllKeys added in v0.3.0

func (mm *StringUintMap) ContainsAllKeys(kk ...string) bool

ContainsAllKeys determines if the given items are all in the map.

func (*StringUintMap) ContainsKey added in v0.3.0

func (mm *StringUintMap) ContainsKey(k string) bool

ContainsKey determines if a given item is already in the map.

func (*StringUintMap) Equals added in v0.3.0

func (mm *StringUintMap) Equals(other *StringUintMap) bool

Equals determines if two maps 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 maps to be equal.

func (*StringUintMap) Exists added in v0.3.0

func (mm *StringUintMap) Exists(p func(string, uint) bool) bool

Exists applies the predicate p 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 (*StringUintMap) Filter added in v0.3.0

func (mm *StringUintMap) Filter(p func(string, uint) bool) *StringUintMap

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*StringUintMap) Find added in v0.3.0

func (mm *StringUintMap) Find(p func(string, uint) bool) (StringUintTuple, bool)

Find returns the first uint that returns true for the predicate p. False is returned if none match.

func (*StringUintMap) FlatMap added in v0.3.0

func (mm *StringUintMap) FlatMap(f func(string, uint) []StringUintTuple) *StringUintMap

FlatMap returns a new UintMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringUintMap) Forall added in v0.3.0

func (mm *StringUintMap) Forall(f func(string, uint) bool) bool

Forall applies the predicate p 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 (*StringUintMap) Foreach added in v0.3.0

func (mm *StringUintMap) Foreach(f func(string, uint))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*StringUintMap) Get added in v0.3.0

func (mm *StringUintMap) Get(k string) (uint, bool)

Get returns one of the items in the map, if present.

func (*StringUintMap) GobDecode added in v0.3.0

func (mm *StringUintMap) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register uint with the 'gob' package before this method is used.

func (*StringUintMap) GobEncode added in v0.3.0

func (mm *StringUintMap) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register uint with the 'gob' package before this method is used.

func (*StringUintMap) IsEmpty added in v0.3.0

func (mm *StringUintMap) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*StringUintMap) Keys added in v0.3.0

func (mm *StringUintMap) Keys() collection.StringList

Keys returns the keys of the current map as a slice.

func (*StringUintMap) Map added in v0.3.0

func (mm *StringUintMap) Map(f func(string, uint) (string, uint)) *StringUintMap

Map returns a new UintMap by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*StringUintMap) MarshalJSON added in v0.3.0

func (mm *StringUintMap) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this map type.

func (*StringUintMap) MkString added in v0.3.0

func (mm *StringUintMap) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*StringUintMap) MkString4 added in v0.7.0

func (mm *StringUintMap) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*StringUintMap) NonEmpty added in v0.3.0

func (mm *StringUintMap) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*StringUintMap) OrderedSlice added in v0.6.0

func (mm *StringUintMap) OrderedSlice(keys collection.StringList) StringUintTuples

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*StringUintMap) Partition added in v0.3.0

func (mm *StringUintMap) Partition(p func(string, uint) bool) (matching *StringUintMap, others *StringUintMap)

Partition applies the predicate p 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.

func (*StringUintMap) Put added in v0.3.0

func (mm *StringUintMap) Put(k string, v uint) *StringUintMap

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*StringUintMap) Size added in v0.3.0

func (mm *StringUintMap) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*StringUintMap) String added in v0.3.0

func (mm *StringUintMap) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*StringUintMap) ToSlice added in v0.3.0

func (mm *StringUintMap) ToSlice() StringUintTuples

ToSlice returns the key/value pairs as a slice

func (*StringUintMap) UnmarshalJSON added in v0.3.0

func (mm *StringUintMap) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this map type.

func (*StringUintMap) Values added in v0.3.0

func (mm *StringUintMap) Values() collection.UintList

Values returns the values of the current map as a slice.

type StringUintTuple added in v0.3.0

type StringUintTuple struct {
	Key string
	Val uint
}

StringUintTuple represents a key/value pair.

func (StringUintTuple) MarshalJSON added in v0.6.0

func (t StringUintTuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (StringUintTuple) UnmarshalJSON added in v0.6.0

func (t StringUintTuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type StringUintTuples added in v0.3.0

type StringUintTuples []StringUintTuple

StringUintTuples can be used as a builder for unmodifiable maps.

func StringUintZip added in v0.3.0

func StringUintZip(keys ...string) StringUintTuples

StringUintZip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewStringUintMap constructor function.

func (StringUintTuples) Append1 added in v0.3.0

func (ts StringUintTuples) Append1(k string, v uint) StringUintTuples

Append1 adds one item.

func (StringUintTuples) Append2 added in v0.3.0

func (ts StringUintTuples) Append2(k1 string, v1 uint, k2 string, v2 uint) StringUintTuples

Append2 adds two items.

func (StringUintTuples) Append3 added in v0.3.0

func (ts StringUintTuples) Append3(k1 string, v1 uint, k2 string, v2 uint, k3 string, v3 uint) StringUintTuples

Append3 adds three items.

func (StringUintTuples) MkString added in v0.6.0

func (ts StringUintTuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (StringUintTuples) MkString4 added in v0.7.0

func (ts StringUintTuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (StringUintTuples) String added in v0.6.0

func (ts StringUintTuples) String() string

func (StringUintTuples) ToMap added in v0.6.0

func (ts StringUintTuples) ToMap() *StringUintMap

ToMap converts the tuples to a map.

func (StringUintTuples) Values added in v0.3.0

func (ts StringUintTuples) Values(values ...uint) StringUintTuples

Values sets the values in a tuple slice. Use this with StringUintZip.

type Uint64Collection added in v0.3.0

type Uint64Collection interface {
	Uint64Sizer
	Uint64MkStringer

	// IsSequence returns true for lists and queues.
	IsSequence() bool

	// IsSet returns false for lists and queues.
	IsSet() bool

	// ToSlice returns a shallow copy as a plain slice.
	ToSlice() []uint64

	// ToInterfaceSlice returns a shallow copy as a slice of arbitrary type.
	ToInterfaceSlice() []interface{}

	// Exists verifies that one or more elements of Uint64Collection return true for the predicate p.
	Exists(p func(uint64) bool) bool

	// Forall verifies that all elements of Uint64Collection return true for the predicate p.
	Forall(p func(uint64) bool) bool

	// Foreach iterates over Uint64Collection and executes the function f against each element.
	Foreach(f func(uint64))

	// Find returns the first uint64 that returns true for the predicate p.
	// False is returned if none match.
	Find(p func(uint64) bool) (uint64, bool)

	// MapToString returns a new []string by transforming every element with function f.
	// The resulting slice is the same size as the collection. The collection is not modified.
	MapToString(f func(uint64) string) []string

	// FlatMapString returns a new []string by transforming every element with function f
	// that returns zero or more items in a slice. The resulting slice may have a different size to the
	// collection. The collection is not modified.
	FlatMapToString(f func(uint64) []string) []string

	// Send returns a channel that will send all the elements in order. Can be used with the plumbing code, for example.
	// A goroutine is created to send the elements; this only terminates when all the elements have been consumed
	Send() <-chan uint64

	// CountBy gives the number elements of Uint64Collection that return true for the predicate p.
	CountBy(p func(uint64) bool) int

	// Contains determines whether a given item is already in the collection, returning true if so.
	Contains(v uint64) bool

	// ContainsAll determines whether the given items are all in the collection, returning true if so.
	ContainsAll(v ...uint64) bool

	// Min returns the minimum value of all the items in the collection. Panics if there are no elements.
	Min() uint64

	// Max returns the minimum value of all the items in the collection. Panics if there are no elements.
	Max() uint64

	// MinBy returns an element of Uint64Collection 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.
	MinBy(less func(uint64, uint64) bool) uint64

	// MaxBy returns an element of Uint64Collection 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.
	MaxBy(less func(uint64, uint64) bool) uint64

	// Fold aggregates all the values in the collection using a supplied function, starting from some initial value.
	Fold(initial uint64, fn func(uint64, uint64) uint64) uint64

	// Sum returns the sum of all the elements in the collection.
	Sum() uint64
}

Uint64Collection defines an interface for common collection methods on uint64.

type Uint64List added in v0.3.0

type Uint64List struct {
	// contains filtered or unexported fields
}

Uint64List contains a slice of type uint64. It is designed to be immutable - ideal for race-free reference lists etc. It encapsulates the slice and provides methods to access it. Importantly, *none of its methods ever mutate a list*; they merely return new lists where required.

List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq

func BuildUint64ListFromChan added in v0.3.0

func BuildUint64ListFromChan(source <-chan uint64) *Uint64List

BuildUint64ListFromChan constructs a new Uint64List from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.

func ConvertUint64List added in v0.3.0

func ConvertUint64List(values ...interface{}) (*Uint64List, bool)

ConvertUint64List 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. Conversions are provided from all built-in numeric types.

func NewUint64List added in v0.3.0

func NewUint64List(values ...uint64) *Uint64List

NewUint64List constructs a new list containing the supplied values, if any.

func (*Uint64List) Append added in v0.3.0

func (list *Uint64List) Append(more ...uint64) *Uint64List

Append returns a new list with all original items and all in `more`; they retain their order. The original list is not altered.

func (*Uint64List) Clone added in v0.3.0

func (list *Uint64List) Clone() *Uint64List

Clone returns the same list, which is immutable.

func (*Uint64List) Contains added in v0.3.0

func (list *Uint64List) Contains(v uint64) bool

Contains determines whether a given item is already in the list, returning true if so.

func (*Uint64List) ContainsAll added in v0.3.0

func (list *Uint64List) ContainsAll(i ...uint64) bool

ContainsAll determines whether the given items are all in the list, returning true if so. This is potentially a slow method and should only be used rarely.

func (*Uint64List) CountBy added in v0.3.0

func (list *Uint64List) CountBy(p func(uint64) bool) (result int)

CountBy gives the number elements of Uint64List that return true for the predicate p.

func (*Uint64List) DistinctBy added in v0.3.0

func (list *Uint64List) DistinctBy(equal func(uint64, uint64) bool) *Uint64List

DistinctBy returns a new Uint64List whose elements are unique, where equality is defined by the equal function.

func (*Uint64List) Drop added in v0.3.0

func (list *Uint64List) Drop(n int) *Uint64List

Drop returns a slice of Uint64List 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 (*Uint64List) DropLast added in v0.3.0

func (list *Uint64List) DropLast(n int) *Uint64List

DropLast returns a slice of Uint64List 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 (*Uint64List) DropWhile added in v0.3.0

func (list *Uint64List) DropWhile(p func(uint64) bool) *Uint64List

DropWhile returns a new Uint64List 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 elements are added.

func (*Uint64List) Equals added in v0.3.0

func (list *Uint64List) Equals(other *Uint64List) 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. Nil lists are considered to be empty.

func (*Uint64List) Exists added in v0.3.0

func (list *Uint64List) Exists(p func(uint64) bool) bool

Exists verifies that one or more elements of Uint64List return true for the predicate p.

func (*Uint64List) Filter added in v0.3.0

func (list *Uint64List) Filter(p func(uint64) bool) *Uint64List

Filter returns a new Uint64List whose elements return true for predicate p.

func (*Uint64List) Find added in v0.3.0

func (list *Uint64List) Find(p func(uint64) bool) (uint64, bool)

Find returns the first uint64 that returns true for predicate p. False is returned if none match.

func (*Uint64List) FlatMap added in v0.3.0

func (list *Uint64List) FlatMap(f func(uint64) []uint64) *Uint64List

FlatMap returns a new Uint64List by transforming every element with function f that returns zero or more items in a slice. The resulting list may have a different size to the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Uint64List) FlatMapToString added in v0.3.0

func (list *Uint64List) FlatMapToString(f func(uint64) []string) []string

FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Uint64List) Fold added in v0.9.0

func (list *Uint64List) Fold(initial uint64, fn func(uint64, uint64) uint64) uint64

Fold aggregates all the values in the list using a supplied function, starting from some initial value.

func (*Uint64List) Forall added in v0.3.0

func (list *Uint64List) Forall(p func(uint64) bool) bool

Forall verifies that all elements of Uint64List return true for the predicate p.

func (*Uint64List) Foreach added in v0.3.0

func (list *Uint64List) Foreach(f func(uint64))

Foreach iterates over Uint64List and executes function f against each element. The function receives copies that do not alter the list elements when they are changed.

func (*Uint64List) Get added in v0.3.0

func (list *Uint64List) Get(i int) uint64

Get gets the specified element in the list. Panics if the index is out of range or the list is nil.

func (*Uint64List) GobDecode added in v0.3.0

func (list *Uint64List) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this list type. You must register uint64 with the 'gob' package before this method is used.

func (Uint64List) GobEncode added in v0.3.0

func (list Uint64List) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register uint64 with the 'gob' package before this method is used.

func (*Uint64List) Head added in v0.3.0

func (list *Uint64List) Head() uint64

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 or nil.

func (*Uint64List) HeadOption added in v0.3.0

func (list *Uint64List) HeadOption() (uint64, bool)

HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.

func (*Uint64List) IndexWhere added in v0.3.0

func (list *Uint64List) IndexWhere(p func(uint64) bool) int

IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.

func (*Uint64List) IndexWhere2 added in v0.3.0

func (list *Uint64List) IndexWhere2(p func(uint64) bool, from int) int

IndexWhere2 finds the index of the first element satisfying predicate p at or after some start index. If none exists, -1 is returned.

func (*Uint64List) Init added in v0.3.0

func (list *Uint64List) Init() *Uint64List

Init gets everything except the last. Init plus Last include the whole list. Init is the opposite of Tail. Panics if list is empty or nil.

func (*Uint64List) IsEmpty added in v0.3.0

func (list *Uint64List) IsEmpty() bool

IsEmpty tests whether Uint64List is empty.

func (*Uint64List) IsSequence added in v0.3.0

func (list *Uint64List) IsSequence() bool

IsSequence returns true for lists and queues.

func (*Uint64List) IsSet added in v0.3.0

func (list *Uint64List) IsSet() bool

IsSet returns false for lists or queues.

func (*Uint64List) Last added in v0.3.0

func (list *Uint64List) Last() uint64

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 or nil.

func (*Uint64List) LastIndexWhere added in v0.3.0

func (list *Uint64List) LastIndexWhere(p func(uint64) bool) int

LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.

func (*Uint64List) LastIndexWhere2 added in v0.3.0

func (list *Uint64List) LastIndexWhere2(p func(uint64) bool, before int) int

LastIndexWhere2 finds the index of the last element satisfying predicate p at or before some start index. If none exists, -1 is returned.

func (*Uint64List) LastOption added in v0.3.0

func (list *Uint64List) LastOption() (uint64, bool)

LastOption gets the last element in the list, if possible. Otherwise returns the zero value.

func (*Uint64List) Len added in v0.3.0

func (list *Uint64List) Len() int

Len returns the number of items in the list - an alias of Size().

func (*Uint64List) Map added in v0.3.0

func (list *Uint64List) Map(f func(uint64) uint64) *Uint64List

Map returns a new Uint64List by transforming every element with function f. The resulting list is the same size as the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Uint64List) MapToString added in v0.3.0

func (list *Uint64List) MapToString(f func(uint64) string) []string

MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (Uint64List) MarshalJSON added in v0.3.0

func (list Uint64List) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this list type.

func (*Uint64List) Max added in v0.3.0

func (list *Uint64List) Max() (result uint64)

Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.

func (*Uint64List) MaxBy added in v0.3.0

func (list *Uint64List) MaxBy(less func(uint64, uint64) bool) uint64

MaxBy returns an element of Uint64List 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 (*Uint64List) Min added in v0.3.0

func (list *Uint64List) Min() uint64

Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.

func (*Uint64List) MinBy added in v0.3.0

func (list *Uint64List) MinBy(less func(uint64, uint64) bool) uint64

MinBy returns an element of Uint64List 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 (*Uint64List) MkString added in v0.3.0

func (list *Uint64List) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*Uint64List) MkString3 added in v0.3.0

func (list *Uint64List) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*Uint64List) NonEmpty added in v0.3.0

func (list *Uint64List) NonEmpty() bool

NonEmpty tests whether Uint64List is empty.

func (*Uint64List) Partition added in v0.3.0

func (list *Uint64List) Partition(p func(uint64) bool) (*Uint64List, *Uint64List)

Partition returns two new uint64Lists 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.

func (*Uint64List) Reverse added in v0.3.0

func (list *Uint64List) Reverse() *Uint64List

Reverse returns a copy of Uint64List with all elements in the reverse order.

func (*Uint64List) Send added in v0.3.0

func (list *Uint64List) Send() <-chan uint64

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. The channel will be closed when all the elements have been sent.

func (*Uint64List) Shuffle added in v0.3.0

func (list *Uint64List) Shuffle() *Uint64List

Shuffle returns a shuffled copy of Uint64List, using a version of the Fisher-Yates shuffle.

func (*Uint64List) Size added in v0.3.0

func (list *Uint64List) Size() int

Size returns the number of items in the list - an alias of Len().

func (*Uint64List) SortBy added in v0.3.0

func (list *Uint64List) SortBy(less func(i, j uint64) bool) *Uint64List

SortBy returns a new list in which the elements are sorted by a specified ordering.

func (*Uint64List) Sorted added in v0.3.0

func (list *Uint64List) Sorted() *Uint64List

Sorted returns a new list in which the elements are sorted by their natural ordering.

func (*Uint64List) StableSortBy added in v0.3.0

func (list *Uint64List) StableSortBy(less func(i, j uint64) bool) *Uint64List

StableSortBy returns a new list in which the elements are sorted by a specified ordering. The algorithm keeps the original order of equal elements.

func (*Uint64List) StableSorted added in v0.3.0

func (list *Uint64List) StableSorted() *Uint64List

StableSorted returns a new list in which the elements are sorted by their natural ordering.

func (*Uint64List) String added in v0.3.0

func (list *Uint64List) String() string

String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.

func (*Uint64List) StringList added in v0.3.0

func (list *Uint64List) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*Uint64List) Sum added in v0.3.0

func (list *Uint64List) Sum() uint64

Sum returns the sum of all the elements in the list.

func (*Uint64List) Tail added in v0.3.0

func (list *Uint64List) Tail() *Uint64List

Tail gets everything except the head. Head plus Tail include the whole list. Tail is the opposite of Init. Panics if list is empty or nil.

func (*Uint64List) Take added in v0.3.0

func (list *Uint64List) Take(n int) *Uint64List

Take returns a slice of Uint64List containing the leading n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.

func (*Uint64List) TakeLast added in v0.3.0

func (list *Uint64List) TakeLast(n int) *Uint64List

TakeLast returns a slice of Uint64List containing the trailing n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.

func (*Uint64List) TakeWhile added in v0.3.0

func (list *Uint64List) TakeWhile(p func(uint64) bool) *Uint64List

TakeWhile returns a new Uint64List 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 elements are excluded.

func (*Uint64List) ToInterfaceSlice added in v0.3.0

func (list *Uint64List) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.

func (*Uint64List) ToList added in v0.3.0

func (list *Uint64List) ToList() *Uint64List

ToList returns the elements of the list as a list, which is an identity operation in this case.

func (*Uint64List) ToSet added in v0.3.0

func (list *Uint64List) ToSet() *Uint64Set

ToSet returns the elements of the list as a set. The returned set is a shallow copy; the list is not altered.

func (*Uint64List) ToSlice added in v0.3.0

func (list *Uint64List) ToSlice() []uint64

ToSlice returns the elements of the current list as a slice.

func (*Uint64List) UnmarshalJSON added in v0.3.0

func (list *Uint64List) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this list type.

type Uint64MkStringer added in v0.3.0

type Uint64MkStringer interface {
	// String implements the Stringer interface to render the list as a comma-separated string enclosed
	// in square brackets.
	String() string

	// MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
	MkString(sep string) string

	// MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
	MkString3(before, between, after string) string

	// implements json.Marshaler interface {
	MarshalJSON() ([]byte, error)

	// StringList gets a slice of strings that depicts all the elements.
	StringList() []string
}

Uint64MkStringer defines an interface for stringer methods on uint64 collections.

type Uint64Sequence added in v0.9.0

type Uint64Sequence interface {
	Uint64Collection

	// Head gets the first element in the sequence. Head plus Tail include the whole sequence. Head is the opposite of Last.
	Head() uint64

	// HeadOption gets the first element in the sequence, if possible.
	HeadOption() (uint64, bool)

	// Last gets the last element in the sequence. Init plus Last include the whole sequence. Last is the opposite of Head.
	Last() uint64

	// LastOption gets the last element in the sequence, if possible.
	LastOption() (uint64, bool)
}

Uint64Sequence defines an interface for sequence methods on uint64.

type Uint64Set added in v0.3.0

type Uint64Set struct {
	// contains filtered or unexported fields
}

Uint64Set is the primary type that represents a set.

func BuildUint64SetFromChan added in v0.3.0

func BuildUint64SetFromChan(source <-chan uint64) *Uint64Set

BuildUint64SetFromChan constructs a new Uint64Set from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.

func ConvertUint64Set added in v0.3.0

func ConvertUint64Set(values ...interface{}) (*Uint64Set, bool)

ConvertUint64Set 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. The returned set will contain all the values that were correctly converted.

func NewUint64Set added in v0.3.0

func NewUint64Set(values ...uint64) *Uint64Set

NewUint64Set creates and returns a reference to an empty set.

func (*Uint64Set) Add added in v0.3.0

func (set *Uint64Set) Add(more ...uint64) *Uint64Set

Add returns a new set with all original items and all in `more`. The original set is not altered.

func (*Uint64Set) Cardinality added in v0.3.0

func (set *Uint64Set) Cardinality() int

Cardinality returns how many items are currently in the set. This is a synonym for Size.

func (*Uint64Set) Clone added in v0.3.0

func (set *Uint64Set) Clone() *Uint64Set

Clone returns the same set, which is immutable.

func (*Uint64Set) Contains added in v0.3.0

func (set *Uint64Set) Contains(i uint64) bool

Contains determines whether a given item is already in the set, returning true if so.

func (*Uint64Set) ContainsAll added in v0.3.0

func (set *Uint64Set) ContainsAll(i ...uint64) bool

ContainsAll determines whether a given item is already in the set, returning true if so.

func (*Uint64Set) CountBy added in v0.3.0

func (set *Uint64Set) CountBy(p func(uint64) bool) (result int)

CountBy gives the number elements of Uint64Set that return true for the predicate p.

func (*Uint64Set) Difference added in v0.3.0

func (set *Uint64Set) Difference(other *Uint64Set) *Uint64Set

Difference returns a new set with items in the current set but not in the other set

func (*Uint64Set) Equals added in v0.3.0

func (set *Uint64Set) Equals(other *Uint64Set) bool

Equals determines whether two sets are equal to each other, returning true if so. 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 (*Uint64Set) Exists added in v0.3.0

func (set *Uint64Set) Exists(p func(uint64) bool) bool

Exists applies a predicate p 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 (*Uint64Set) Filter added in v0.3.0

func (set *Uint64Set) Filter(p func(uint64) bool) *Uint64Set

Filter returns a new Uint64Set whose elements return true for the predicate p.

func (*Uint64Set) Find added in v0.3.0

func (set *Uint64Set) Find(p func(uint64) bool) (uint64, bool)

Find returns the first uint64 that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.

func (*Uint64Set) FlatMap added in v0.3.0

func (set *Uint64Set) FlatMap(f func(uint64) []uint64) *Uint64Set

FlatMap returns a new Uint64Set by transforming every element with a function f that returns zero or more items in a slice. The resulting set may have a different size to the original set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Uint64Set) FlatMapToString added in v0.3.0

func (set *Uint64Set) FlatMapToString(f func(uint64) []string) []string

FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Uint64Set) Fold added in v0.9.0

func (set *Uint64Set) Fold(initial uint64, fn func(uint64, uint64) uint64) uint64

Fold aggregates all the values in the set using a supplied function, starting from some initial value.

func (*Uint64Set) Forall added in v0.3.0

func (set *Uint64Set) Forall(p func(uint64) bool) bool

Forall applies a predicate function p 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 (*Uint64Set) Foreach added in v0.3.0

func (set *Uint64Set) Foreach(f func(uint64))

Foreach iterates over uint64Set and executes the function f against each element.

func (*Uint64Set) GobDecode added in v0.3.0

func (set *Uint64Set) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this set type. You must register uint64 with the 'gob' package before this method is used.

func (Uint64Set) GobEncode added in v0.3.0

func (set Uint64Set) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register uint64 with the 'gob' package before this method is used.

func (*Uint64Set) Intersect added in v0.3.0

func (set *Uint64Set) Intersect(other *Uint64Set) *Uint64Set

Intersect returns a new set with items that exist only in both sets.

func (*Uint64Set) IsEmpty added in v0.3.0

func (set *Uint64Set) IsEmpty() bool

IsEmpty returns true if the set is empty.

func (*Uint64Set) IsSequence added in v0.3.0

func (set *Uint64Set) IsSequence() bool

IsSequence returns true for lists and queues.

func (*Uint64Set) IsSet added in v0.3.0

func (set *Uint64Set) IsSet() bool

IsSet returns false for lists or queues.

func (*Uint64Set) IsSubset added in v0.3.0

func (set *Uint64Set) IsSubset(other *Uint64Set) bool

IsSubset determines whether every item in the other set is in this set, returning true if so.

func (*Uint64Set) IsSuperset added in v0.3.0

func (set *Uint64Set) IsSuperset(other *Uint64Set) bool

IsSuperset determines whether every item of this set is in the other set, returning true if so.

func (*Uint64Set) Map added in v0.3.0

func (set *Uint64Set) Map(f func(uint64) uint64) *Uint64Set

Map returns a new Uint64Set by transforming every element with a function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Uint64Set) MapToString added in v0.3.0

func (set *Uint64Set) MapToString(f func(uint64) string) []string

MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Uint64Set) MarshalJSON added in v0.3.0

func (set *Uint64Set) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this set type.

func (*Uint64Set) Max added in v0.3.0

func (set *Uint64Set) Max() (result uint64)

Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.

func (*Uint64Set) MaxBy added in v0.3.0

func (set *Uint64Set) MaxBy(less func(uint64, uint64) bool) uint64

MaxBy returns an element of Uint64Set 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 (*Uint64Set) Min added in v0.3.0

func (set *Uint64Set) Min() uint64

Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.

func (*Uint64Set) MinBy added in v0.3.0

func (set *Uint64Set) MinBy(less func(uint64, uint64) bool) uint64

MinBy returns an element of Uint64Set 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 (*Uint64Set) MkString added in v0.3.0

func (set *Uint64Set) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*Uint64Set) MkString3 added in v0.3.0

func (set *Uint64Set) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*Uint64Set) NonEmpty added in v0.3.0

func (set *Uint64Set) NonEmpty() bool

NonEmpty returns true if the set is not empty.

func (*Uint64Set) Partition added in v0.3.0

func (set *Uint64Set) Partition(p func(uint64) bool) (*Uint64Set, *Uint64Set)

Partition returns two new uint64Sets 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.

func (*Uint64Set) Remove added in v0.3.0

func (set *Uint64Set) Remove(i uint64) *Uint64Set

Remove removes a single item from the set. A new set is returned that has all the elements except the removed one.

func (*Uint64Set) Send added in v0.3.0

func (set *Uint64Set) Send() <-chan uint64

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 (*Uint64Set) Size added in v0.3.0

func (set *Uint64Set) Size() int

Size returns how many items are currently in the set. This is a synonym for Cardinality.

func (*Uint64Set) String added in v0.3.0

func (set *Uint64Set) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*Uint64Set) StringList added in v0.3.0

func (set *Uint64Set) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*Uint64Set) StringMap added in v0.3.0

func (set *Uint64Set) StringMap() map[string]bool

StringMap renders the set as a map of strings. The value of each item in the set becomes stringified as a key in the resulting map.

func (*Uint64Set) Sum added in v0.3.0

func (set *Uint64Set) Sum() uint64

Sum returns the sum of all the elements in the set.

func (*Uint64Set) SymmetricDifference added in v0.3.0

func (set *Uint64Set) SymmetricDifference(other *Uint64Set) *Uint64Set

SymmetricDifference returns a new set with items in the current set or the other set but not in both.

func (*Uint64Set) ToInterfaceSlice added in v0.3.0

func (set *Uint64Set) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.

func (*Uint64Set) ToList added in v0.3.0

func (set *Uint64Set) ToList() *Uint64List

ToList returns the elements of the set as a list. The returned list is a shallow copy; the set is not altered.

func (*Uint64Set) ToSet added in v0.3.0

func (set *Uint64Set) ToSet() *Uint64Set

ToSet returns the set; this is an identity operation in this case.

func (*Uint64Set) ToSlice added in v0.3.0

func (set *Uint64Set) ToSlice() []uint64

ToSlice returns the elements of the current set as a slice.

func (*Uint64Set) Union added in v0.3.0

func (set *Uint64Set) Union(other *Uint64Set) *Uint64Set

Union returns a new set with all items in both sets.

func (*Uint64Set) UnmarshalJSON added in v0.3.0

func (set *Uint64Set) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this set type.

type Uint64Sizer added in v0.3.0

type Uint64Sizer interface {
	// IsEmpty tests whether Uint64Collection is empty.
	IsEmpty() bool

	// NonEmpty tests whether Uint64Collection is empty.
	NonEmpty() bool

	// Size returns the number of items in the list - an alias of Len().
	Size() int
}

Uint64Sizer defines an interface for sizing methods on uint64 collections.

type Uint64StringMap added in v0.4.0

type Uint64StringMap struct {
	// contains filtered or unexported fields
}

Uint64StringMap is the primary type that represents a thread-safe map

func NewUint64StringMap added in v0.4.0

func NewUint64StringMap(kv ...Uint64StringTuple) *Uint64StringMap

NewUint64StringMap creates and returns a reference to a map, optionally containing some items.

func NewUint64StringMap1 added in v0.4.0

func NewUint64StringMap1(k uint64, v string) *Uint64StringMap

NewUint64StringMap1 creates and returns a reference to a map containing one item.

func (*Uint64StringMap) Clone added in v0.4.0

func (mm *Uint64StringMap) Clone() *Uint64StringMap

Clone returns the same map, which is immutable.

func (*Uint64StringMap) ContainsAllKeys added in v0.4.0

func (mm *Uint64StringMap) ContainsAllKeys(kk ...uint64) bool

ContainsAllKeys determines if the given items are all in the map.

func (*Uint64StringMap) ContainsKey added in v0.4.0

func (mm *Uint64StringMap) ContainsKey(k uint64) bool

ContainsKey determines if a given item is already in the map.

func (*Uint64StringMap) Equals added in v0.4.0

func (mm *Uint64StringMap) Equals(other *Uint64StringMap) bool

Equals determines if two maps 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 maps to be equal.

func (*Uint64StringMap) Exists added in v0.4.0

func (mm *Uint64StringMap) Exists(p func(uint64, string) bool) bool

Exists applies the predicate p 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 (*Uint64StringMap) Filter added in v0.4.0

func (mm *Uint64StringMap) Filter(p func(uint64, string) bool) *Uint64StringMap

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*Uint64StringMap) Find added in v0.4.0

func (mm *Uint64StringMap) Find(p func(uint64, string) bool) (Uint64StringTuple, bool)

Find returns the first string that returns true for the predicate p. False is returned if none match.

func (*Uint64StringMap) FlatMap added in v0.4.0

FlatMap returns a new StringMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Uint64StringMap) Forall added in v0.4.0

func (mm *Uint64StringMap) Forall(f func(uint64, string) bool) bool

Forall applies the predicate p 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 (*Uint64StringMap) Foreach added in v0.4.0

func (mm *Uint64StringMap) Foreach(f func(uint64, string))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*Uint64StringMap) Get added in v0.4.0

func (mm *Uint64StringMap) Get(k uint64) (string, bool)

Get returns one of the items in the map, if present.

func (*Uint64StringMap) GobDecode added in v0.4.0

func (mm *Uint64StringMap) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register string with the 'gob' package before this method is used.

func (*Uint64StringMap) GobEncode added in v0.4.0

func (mm *Uint64StringMap) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register string with the 'gob' package before this method is used.

func (*Uint64StringMap) IsEmpty added in v0.4.0

func (mm *Uint64StringMap) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*Uint64StringMap) Keys added in v0.4.0

Keys returns the keys of the current map as a slice.

func (*Uint64StringMap) Map added in v0.4.0

func (mm *Uint64StringMap) Map(f func(uint64, string) (uint64, string)) *Uint64StringMap

Map returns a new StringMap by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Uint64StringMap) MkString added in v0.4.0

func (mm *Uint64StringMap) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*Uint64StringMap) MkString4 added in v0.7.0

func (mm *Uint64StringMap) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*Uint64StringMap) NonEmpty added in v0.4.0

func (mm *Uint64StringMap) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*Uint64StringMap) OrderedSlice added in v0.6.0

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*Uint64StringMap) Partition added in v0.4.0

func (mm *Uint64StringMap) Partition(p func(uint64, string) bool) (matching *Uint64StringMap, others *Uint64StringMap)

Partition applies the predicate p 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.

func (*Uint64StringMap) Put added in v0.4.0

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*Uint64StringMap) Size added in v0.4.0

func (mm *Uint64StringMap) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*Uint64StringMap) String added in v0.4.0

func (mm *Uint64StringMap) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*Uint64StringMap) ToSlice added in v0.4.0

func (mm *Uint64StringMap) ToSlice() Uint64StringTuples

ToSlice returns the key/value pairs as a slice

func (*Uint64StringMap) Values added in v0.4.0

func (mm *Uint64StringMap) Values() collection.StringList

Values returns the values of the current map as a slice.

type Uint64StringTuple added in v0.4.0

type Uint64StringTuple struct {
	Key uint64
	Val string
}

Uint64StringTuple represents a key/value pair.

func (Uint64StringTuple) MarshalJSON added in v0.6.0

func (t Uint64StringTuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (Uint64StringTuple) UnmarshalJSON added in v0.6.0

func (t Uint64StringTuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type Uint64StringTuples added in v0.4.0

type Uint64StringTuples []Uint64StringTuple

Uint64StringTuples can be used as a builder for unmodifiable maps.

func Uint64StringZip added in v0.4.0

func Uint64StringZip(keys ...uint64) Uint64StringTuples

Uint64StringZip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewUint64StringMap constructor function.

func (Uint64StringTuples) Append1 added in v0.4.0

Append1 adds one item.

func (Uint64StringTuples) Append2 added in v0.4.0

func (ts Uint64StringTuples) Append2(k1 uint64, v1 string, k2 uint64, v2 string) Uint64StringTuples

Append2 adds two items.

func (Uint64StringTuples) Append3 added in v0.4.0

func (ts Uint64StringTuples) Append3(k1 uint64, v1 string, k2 uint64, v2 string, k3 uint64, v3 string) Uint64StringTuples

Append3 adds three items.

func (Uint64StringTuples) MkString added in v0.6.0

func (ts Uint64StringTuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (Uint64StringTuples) MkString4 added in v0.7.0

func (ts Uint64StringTuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (Uint64StringTuples) String added in v0.6.0

func (ts Uint64StringTuples) String() string

func (Uint64StringTuples) ToMap added in v0.6.0

func (ts Uint64StringTuples) ToMap() *Uint64StringMap

ToMap converts the tuples to a map.

func (Uint64StringTuples) Values added in v0.4.0

func (ts Uint64StringTuples) Values(values ...string) Uint64StringTuples

Values sets the values in a tuple slice. Use this with Uint64StringZip.

type Uint64Uint64Map added in v0.3.0

type Uint64Uint64Map struct {
	// contains filtered or unexported fields
}

Uint64Uint64Map is the primary type that represents a thread-safe map

func NewUint64Uint64Map added in v0.3.0

func NewUint64Uint64Map(kv ...Uint64Uint64Tuple) *Uint64Uint64Map

NewUint64Uint64Map creates and returns a reference to a map, optionally containing some items.

func NewUint64Uint64Map1 added in v0.3.0

func NewUint64Uint64Map1(k uint64, v uint64) *Uint64Uint64Map

NewUint64Uint64Map1 creates and returns a reference to a map containing one item.

func (*Uint64Uint64Map) Clone added in v0.3.0

func (mm *Uint64Uint64Map) Clone() *Uint64Uint64Map

Clone returns the same map, which is immutable.

func (*Uint64Uint64Map) ContainsAllKeys added in v0.3.0

func (mm *Uint64Uint64Map) ContainsAllKeys(kk ...uint64) bool

ContainsAllKeys determines if the given items are all in the map.

func (*Uint64Uint64Map) ContainsKey added in v0.3.0

func (mm *Uint64Uint64Map) ContainsKey(k uint64) bool

ContainsKey determines if a given item is already in the map.

func (*Uint64Uint64Map) Equals added in v0.3.0

func (mm *Uint64Uint64Map) Equals(other *Uint64Uint64Map) bool

Equals determines if two maps 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 maps to be equal.

func (*Uint64Uint64Map) Exists added in v0.3.0

func (mm *Uint64Uint64Map) Exists(p func(uint64, uint64) bool) bool

Exists applies the predicate p 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 (*Uint64Uint64Map) Filter added in v0.3.0

func (mm *Uint64Uint64Map) Filter(p func(uint64, uint64) bool) *Uint64Uint64Map

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*Uint64Uint64Map) Find added in v0.3.0

func (mm *Uint64Uint64Map) Find(p func(uint64, uint64) bool) (Uint64Uint64Tuple, bool)

Find returns the first uint64 that returns true for the predicate p. False is returned if none match.

func (*Uint64Uint64Map) FlatMap added in v0.3.0

FlatMap returns a new Uint64Map by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Uint64Uint64Map) Forall added in v0.3.0

func (mm *Uint64Uint64Map) Forall(f func(uint64, uint64) bool) bool

Forall applies the predicate p 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 (*Uint64Uint64Map) Foreach added in v0.3.0

func (mm *Uint64Uint64Map) Foreach(f func(uint64, uint64))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*Uint64Uint64Map) Get added in v0.3.0

func (mm *Uint64Uint64Map) Get(k uint64) (uint64, bool)

Get returns one of the items in the map, if present.

func (*Uint64Uint64Map) GobDecode added in v0.3.0

func (mm *Uint64Uint64Map) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register uint64 with the 'gob' package before this method is used.

func (*Uint64Uint64Map) GobEncode added in v0.3.0

func (mm *Uint64Uint64Map) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register uint64 with the 'gob' package before this method is used.

func (*Uint64Uint64Map) IsEmpty added in v0.3.0

func (mm *Uint64Uint64Map) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*Uint64Uint64Map) Keys added in v0.3.0

Keys returns the keys of the current map as a slice.

func (*Uint64Uint64Map) Map added in v0.3.0

func (mm *Uint64Uint64Map) Map(f func(uint64, uint64) (uint64, uint64)) *Uint64Uint64Map

Map returns a new Uint64Map by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*Uint64Uint64Map) MkString added in v0.3.0

func (mm *Uint64Uint64Map) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*Uint64Uint64Map) MkString4 added in v0.7.0

func (mm *Uint64Uint64Map) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*Uint64Uint64Map) NonEmpty added in v0.3.0

func (mm *Uint64Uint64Map) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*Uint64Uint64Map) OrderedSlice added in v0.6.0

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*Uint64Uint64Map) Partition added in v0.3.0

func (mm *Uint64Uint64Map) Partition(p func(uint64, uint64) bool) (matching *Uint64Uint64Map, others *Uint64Uint64Map)

Partition applies the predicate p 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.

func (*Uint64Uint64Map) Put added in v0.3.0

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*Uint64Uint64Map) Size added in v0.3.0

func (mm *Uint64Uint64Map) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*Uint64Uint64Map) String added in v0.3.0

func (mm *Uint64Uint64Map) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*Uint64Uint64Map) ToSlice added in v0.3.0

func (mm *Uint64Uint64Map) ToSlice() Uint64Uint64Tuples

ToSlice returns the key/value pairs as a slice

func (*Uint64Uint64Map) Values added in v0.3.0

func (mm *Uint64Uint64Map) Values() collection.Uint64List

Values returns the values of the current map as a slice.

type Uint64Uint64Tuple added in v0.3.0

type Uint64Uint64Tuple struct {
	Key uint64
	Val uint64
}

Uint64Uint64Tuple represents a key/value pair.

func (Uint64Uint64Tuple) MarshalJSON added in v0.6.0

func (t Uint64Uint64Tuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (Uint64Uint64Tuple) UnmarshalJSON added in v0.6.0

func (t Uint64Uint64Tuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type Uint64Uint64Tuples added in v0.3.0

type Uint64Uint64Tuples []Uint64Uint64Tuple

Uint64Uint64Tuples can be used as a builder for unmodifiable maps.

func Uint64Uint64Zip added in v0.3.0

func Uint64Uint64Zip(keys ...uint64) Uint64Uint64Tuples

Uint64Uint64Zip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewUint64Uint64Map constructor function.

func (Uint64Uint64Tuples) Append1 added in v0.3.0

Append1 adds one item.

func (Uint64Uint64Tuples) Append2 added in v0.3.0

func (ts Uint64Uint64Tuples) Append2(k1 uint64, v1 uint64, k2 uint64, v2 uint64) Uint64Uint64Tuples

Append2 adds two items.

func (Uint64Uint64Tuples) Append3 added in v0.3.0

func (ts Uint64Uint64Tuples) Append3(k1 uint64, v1 uint64, k2 uint64, v2 uint64, k3 uint64, v3 uint64) Uint64Uint64Tuples

Append3 adds three items.

func (Uint64Uint64Tuples) MkString added in v0.6.0

func (ts Uint64Uint64Tuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (Uint64Uint64Tuples) MkString4 added in v0.7.0

func (ts Uint64Uint64Tuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (Uint64Uint64Tuples) String added in v0.6.0

func (ts Uint64Uint64Tuples) String() string

func (Uint64Uint64Tuples) ToMap added in v0.6.0

func (ts Uint64Uint64Tuples) ToMap() *Uint64Uint64Map

ToMap converts the tuples to a map.

func (Uint64Uint64Tuples) Values added in v0.3.0

func (ts Uint64Uint64Tuples) Values(values ...uint64) Uint64Uint64Tuples

Values sets the values in a tuple slice. Use this with Uint64Uint64Zip.

type UintCollection added in v0.3.0

type UintCollection interface {
	UintSizer
	UintMkStringer

	// IsSequence returns true for lists and queues.
	IsSequence() bool

	// IsSet returns false for lists and queues.
	IsSet() bool

	// ToSlice returns a shallow copy as a plain slice.
	ToSlice() []uint

	// ToInterfaceSlice returns a shallow copy as a slice of arbitrary type.
	ToInterfaceSlice() []interface{}

	// Exists verifies that one or more elements of UintCollection return true for the predicate p.
	Exists(p func(uint) bool) bool

	// Forall verifies that all elements of UintCollection return true for the predicate p.
	Forall(p func(uint) bool) bool

	// Foreach iterates over UintCollection and executes the function f against each element.
	Foreach(f func(uint))

	// Find returns the first uint that returns true for the predicate p.
	// False is returned if none match.
	Find(p func(uint) bool) (uint, bool)

	// MapToString returns a new []string by transforming every element with function f.
	// The resulting slice is the same size as the collection. The collection is not modified.
	MapToString(f func(uint) string) []string

	// FlatMapString returns a new []string by transforming every element with function f
	// that returns zero or more items in a slice. The resulting slice may have a different size to the
	// collection. The collection is not modified.
	FlatMapToString(f func(uint) []string) []string

	// Send returns a channel that will send all the elements in order. Can be used with the plumbing code, for example.
	// A goroutine is created to send the elements; this only terminates when all the elements have been consumed
	Send() <-chan uint

	// CountBy gives the number elements of UintCollection that return true for the predicate p.
	CountBy(p func(uint) bool) int

	// Contains determines whether a given item is already in the collection, returning true if so.
	Contains(v uint) bool

	// ContainsAll determines whether the given items are all in the collection, returning true if so.
	ContainsAll(v ...uint) bool

	// Min returns the minimum value of all the items in the collection. Panics if there are no elements.
	Min() uint

	// Max returns the minimum value of all the items in the collection. Panics if there are no elements.
	Max() uint

	// MinBy returns an element of UintCollection 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.
	MinBy(less func(uint, uint) bool) uint

	// MaxBy returns an element of UintCollection 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.
	MaxBy(less func(uint, uint) bool) uint

	// Fold aggregates all the values in the collection using a supplied function, starting from some initial value.
	Fold(initial uint, fn func(uint, uint) uint) uint

	// Sum returns the sum of all the elements in the collection.
	Sum() uint
}

UintCollection defines an interface for common collection methods on uint.

type UintList added in v0.3.0

type UintList struct {
	// contains filtered or unexported fields
}

UintList contains a slice of type uint. It is designed to be immutable - ideal for race-free reference lists etc. It encapsulates the slice and provides methods to access it. Importantly, *none of its methods ever mutate a list*; they merely return new lists where required.

List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq

func BuildUintListFromChan added in v0.3.0

func BuildUintListFromChan(source <-chan uint) *UintList

BuildUintListFromChan constructs a new UintList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.

func ConvertUintList added in v0.3.0

func ConvertUintList(values ...interface{}) (*UintList, bool)

ConvertUintList 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. Conversions are provided from all built-in numeric types.

func NewUintList added in v0.3.0

func NewUintList(values ...uint) *UintList

NewUintList constructs a new list containing the supplied values, if any.

func (*UintList) Append added in v0.3.0

func (list *UintList) Append(more ...uint) *UintList

Append returns a new list with all original items and all in `more`; they retain their order. The original list is not altered.

func (*UintList) Clone added in v0.3.0

func (list *UintList) Clone() *UintList

Clone returns the same list, which is immutable.

func (*UintList) Contains added in v0.3.0

func (list *UintList) Contains(v uint) bool

Contains determines whether a given item is already in the list, returning true if so.

func (*UintList) ContainsAll added in v0.3.0

func (list *UintList) ContainsAll(i ...uint) bool

ContainsAll determines whether the given items are all in the list, returning true if so. This is potentially a slow method and should only be used rarely.

func (*UintList) CountBy added in v0.3.0

func (list *UintList) CountBy(p func(uint) bool) (result int)

CountBy gives the number elements of UintList that return true for the predicate p.

func (*UintList) DistinctBy added in v0.3.0

func (list *UintList) DistinctBy(equal func(uint, uint) bool) *UintList

DistinctBy returns a new UintList whose elements are unique, where equality is defined by the equal function.

func (*UintList) Drop added in v0.3.0

func (list *UintList) Drop(n int) *UintList

Drop returns a slice of UintList 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 (*UintList) DropLast added in v0.3.0

func (list *UintList) DropLast(n int) *UintList

DropLast returns a slice of UintList 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 (*UintList) DropWhile added in v0.3.0

func (list *UintList) DropWhile(p func(uint) bool) *UintList

DropWhile returns a new UintList 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 elements are added.

func (*UintList) Equals added in v0.3.0

func (list *UintList) Equals(other *UintList) 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. Nil lists are considered to be empty.

func (*UintList) Exists added in v0.3.0

func (list *UintList) Exists(p func(uint) bool) bool

Exists verifies that one or more elements of UintList return true for the predicate p.

func (*UintList) Filter added in v0.3.0

func (list *UintList) Filter(p func(uint) bool) *UintList

Filter returns a new UintList whose elements return true for predicate p.

func (*UintList) Find added in v0.3.0

func (list *UintList) Find(p func(uint) bool) (uint, bool)

Find returns the first uint that returns true for predicate p. False is returned if none match.

func (*UintList) FlatMap added in v0.3.0

func (list *UintList) FlatMap(f func(uint) []uint) *UintList

FlatMap returns a new UintList by transforming every element with function f that returns zero or more items in a slice. The resulting list may have a different size to the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*UintList) FlatMapToString added in v0.3.0

func (list *UintList) FlatMapToString(f func(uint) []string) []string

FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*UintList) Fold added in v0.9.0

func (list *UintList) Fold(initial uint, fn func(uint, uint) uint) uint

Fold aggregates all the values in the list using a supplied function, starting from some initial value.

func (*UintList) Forall added in v0.3.0

func (list *UintList) Forall(p func(uint) bool) bool

Forall verifies that all elements of UintList return true for the predicate p.

func (*UintList) Foreach added in v0.3.0

func (list *UintList) Foreach(f func(uint))

Foreach iterates over UintList and executes function f against each element. The function receives copies that do not alter the list elements when they are changed.

func (*UintList) Get added in v0.3.0

func (list *UintList) Get(i int) uint

Get gets the specified element in the list. Panics if the index is out of range or the list is nil.

func (*UintList) GobDecode added in v0.3.0

func (list *UintList) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this list type. You must register uint with the 'gob' package before this method is used.

func (UintList) GobEncode added in v0.3.0

func (list UintList) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register uint with the 'gob' package before this method is used.

func (*UintList) Head added in v0.3.0

func (list *UintList) Head() uint

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 or nil.

func (*UintList) HeadOption added in v0.3.0

func (list *UintList) HeadOption() (uint, bool)

HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.

func (*UintList) IndexWhere added in v0.3.0

func (list *UintList) IndexWhere(p func(uint) bool) int

IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.

func (*UintList) IndexWhere2 added in v0.3.0

func (list *UintList) IndexWhere2(p func(uint) bool, from int) int

IndexWhere2 finds the index of the first element satisfying predicate p at or after some start index. If none exists, -1 is returned.

func (*UintList) Init added in v0.3.0

func (list *UintList) Init() *UintList

Init gets everything except the last. Init plus Last include the whole list. Init is the opposite of Tail. Panics if list is empty or nil.

func (*UintList) IsEmpty added in v0.3.0

func (list *UintList) IsEmpty() bool

IsEmpty tests whether UintList is empty.

func (*UintList) IsSequence added in v0.3.0

func (list *UintList) IsSequence() bool

IsSequence returns true for lists and queues.

func (*UintList) IsSet added in v0.3.0

func (list *UintList) IsSet() bool

IsSet returns false for lists or queues.

func (*UintList) Last added in v0.3.0

func (list *UintList) Last() uint

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 or nil.

func (*UintList) LastIndexWhere added in v0.3.0

func (list *UintList) LastIndexWhere(p func(uint) bool) int

LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.

func (*UintList) LastIndexWhere2 added in v0.3.0

func (list *UintList) LastIndexWhere2(p func(uint) bool, before int) int

LastIndexWhere2 finds the index of the last element satisfying predicate p at or before some start index. If none exists, -1 is returned.

func (*UintList) LastOption added in v0.3.0

func (list *UintList) LastOption() (uint, bool)

LastOption gets the last element in the list, if possible. Otherwise returns the zero value.

func (*UintList) Len added in v0.3.0

func (list *UintList) Len() int

Len returns the number of items in the list - an alias of Size().

func (*UintList) Map added in v0.3.0

func (list *UintList) Map(f func(uint) uint) *UintList

Map returns a new UintList by transforming every element with function f. The resulting list is the same size as the original list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*UintList) MapToString added in v0.3.0

func (list *UintList) MapToString(f func(uint) string) []string

MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the list.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (UintList) MarshalJSON added in v0.3.0

func (list UintList) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this list type.

func (*UintList) Max added in v0.3.0

func (list *UintList) Max() (result uint)

Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.

func (*UintList) MaxBy added in v0.3.0

func (list *UintList) MaxBy(less func(uint, uint) bool) uint

MaxBy returns an element of UintList 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 (*UintList) Min added in v0.3.0

func (list *UintList) Min() uint

Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.

func (*UintList) MinBy added in v0.3.0

func (list *UintList) MinBy(less func(uint, uint) bool) uint

MinBy returns an element of UintList 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 (*UintList) MkString added in v0.3.0

func (list *UintList) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*UintList) MkString3 added in v0.3.0

func (list *UintList) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*UintList) NonEmpty added in v0.3.0

func (list *UintList) NonEmpty() bool

NonEmpty tests whether UintList is empty.

func (*UintList) Partition added in v0.3.0

func (list *UintList) Partition(p func(uint) bool) (*UintList, *UintList)

Partition returns two new uintLists 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.

func (*UintList) Reverse added in v0.3.0

func (list *UintList) Reverse() *UintList

Reverse returns a copy of UintList with all elements in the reverse order.

func (*UintList) Send added in v0.3.0

func (list *UintList) Send() <-chan uint

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. The channel will be closed when all the elements have been sent.

func (*UintList) Shuffle added in v0.3.0

func (list *UintList) Shuffle() *UintList

Shuffle returns a shuffled copy of UintList, using a version of the Fisher-Yates shuffle.

func (*UintList) Size added in v0.3.0

func (list *UintList) Size() int

Size returns the number of items in the list - an alias of Len().

func (*UintList) SortBy added in v0.3.0

func (list *UintList) SortBy(less func(i, j uint) bool) *UintList

SortBy returns a new list in which the elements are sorted by a specified ordering.

func (*UintList) Sorted added in v0.3.0

func (list *UintList) Sorted() *UintList

Sorted returns a new list in which the elements are sorted by their natural ordering.

func (*UintList) StableSortBy added in v0.3.0

func (list *UintList) StableSortBy(less func(i, j uint) bool) *UintList

StableSortBy returns a new list in which the elements are sorted by a specified ordering. The algorithm keeps the original order of equal elements.

func (*UintList) StableSorted added in v0.3.0

func (list *UintList) StableSorted() *UintList

StableSorted returns a new list in which the elements are sorted by their natural ordering.

func (*UintList) String added in v0.3.0

func (list *UintList) String() string

String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.

func (*UintList) StringList added in v0.3.0

func (list *UintList) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*UintList) Sum added in v0.3.0

func (list *UintList) Sum() uint

Sum returns the sum of all the elements in the list.

func (*UintList) Tail added in v0.3.0

func (list *UintList) Tail() *UintList

Tail gets everything except the head. Head plus Tail include the whole list. Tail is the opposite of Init. Panics if list is empty or nil.

func (*UintList) Take added in v0.3.0

func (list *UintList) Take(n int) *UintList

Take returns a slice of UintList containing the leading n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.

func (*UintList) TakeLast added in v0.3.0

func (list *UintList) TakeLast(n int) *UintList

TakeLast returns a slice of UintList containing the trailing n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.

func (*UintList) TakeWhile added in v0.3.0

func (list *UintList) TakeWhile(p func(uint) bool) *UintList

TakeWhile returns a new UintList 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 elements are excluded.

func (*UintList) ToInterfaceSlice added in v0.3.0

func (list *UintList) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.

func (*UintList) ToList added in v0.3.0

func (list *UintList) ToList() *UintList

ToList returns the elements of the list as a list, which is an identity operation in this case.

func (*UintList) ToSet added in v0.3.0

func (list *UintList) ToSet() *UintSet

ToSet returns the elements of the list as a set. The returned set is a shallow copy; the list is not altered.

func (*UintList) ToSlice added in v0.3.0

func (list *UintList) ToSlice() []uint

ToSlice returns the elements of the current list as a slice.

func (*UintList) UnmarshalJSON added in v0.3.0

func (list *UintList) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this list type.

type UintMkStringer added in v0.3.0

type UintMkStringer interface {
	// String implements the Stringer interface to render the list as a comma-separated string enclosed
	// in square brackets.
	String() string

	// MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
	MkString(sep string) string

	// MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
	MkString3(before, between, after string) string

	// implements json.Marshaler interface {
	MarshalJSON() ([]byte, error)

	// StringList gets a slice of strings that depicts all the elements.
	StringList() []string
}

UintMkStringer defines an interface for stringer methods on uint collections.

type UintSequence added in v0.9.0

type UintSequence interface {
	UintCollection

	// Head gets the first element in the sequence. Head plus Tail include the whole sequence. Head is the opposite of Last.
	Head() uint

	// HeadOption gets the first element in the sequence, if possible.
	HeadOption() (uint, bool)

	// Last gets the last element in the sequence. Init plus Last include the whole sequence. Last is the opposite of Head.
	Last() uint

	// LastOption gets the last element in the sequence, if possible.
	LastOption() (uint, bool)
}

UintSequence defines an interface for sequence methods on uint.

type UintSet added in v0.3.0

type UintSet struct {
	// contains filtered or unexported fields
}

UintSet is the primary type that represents a set.

func BuildUintSetFromChan added in v0.3.0

func BuildUintSetFromChan(source <-chan uint) *UintSet

BuildUintSetFromChan constructs a new UintSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.

func ConvertUintSet added in v0.3.0

func ConvertUintSet(values ...interface{}) (*UintSet, bool)

ConvertUintSet 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. The returned set will contain all the values that were correctly converted.

func NewUintSet added in v0.3.0

func NewUintSet(values ...uint) *UintSet

NewUintSet creates and returns a reference to an empty set.

func (*UintSet) Add added in v0.3.0

func (set *UintSet) Add(more ...uint) *UintSet

Add returns a new set with all original items and all in `more`. The original set is not altered.

func (*UintSet) Cardinality added in v0.3.0

func (set *UintSet) Cardinality() int

Cardinality returns how many items are currently in the set. This is a synonym for Size.

func (*UintSet) Clone added in v0.3.0

func (set *UintSet) Clone() *UintSet

Clone returns the same set, which is immutable.

func (*UintSet) Contains added in v0.3.0

func (set *UintSet) Contains(i uint) bool

Contains determines whether a given item is already in the set, returning true if so.

func (*UintSet) ContainsAll added in v0.3.0

func (set *UintSet) ContainsAll(i ...uint) bool

ContainsAll determines whether a given item is already in the set, returning true if so.

func (*UintSet) CountBy added in v0.3.0

func (set *UintSet) CountBy(p func(uint) bool) (result int)

CountBy gives the number elements of UintSet that return true for the predicate p.

func (*UintSet) Difference added in v0.3.0

func (set *UintSet) Difference(other *UintSet) *UintSet

Difference returns a new set with items in the current set but not in the other set

func (*UintSet) Equals added in v0.3.0

func (set *UintSet) Equals(other *UintSet) bool

Equals determines whether two sets are equal to each other, returning true if so. 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 (*UintSet) Exists added in v0.3.0

func (set *UintSet) Exists(p func(uint) bool) bool

Exists applies a predicate p 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 (*UintSet) Filter added in v0.3.0

func (set *UintSet) Filter(p func(uint) bool) *UintSet

Filter returns a new UintSet whose elements return true for the predicate p.

func (*UintSet) Find added in v0.3.0

func (set *UintSet) Find(p func(uint) bool) (uint, bool)

Find returns the first uint that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.

func (*UintSet) FlatMap added in v0.3.0

func (set *UintSet) FlatMap(f func(uint) []uint) *UintSet

FlatMap returns a new UintSet by transforming every element with a function f that returns zero or more items in a slice. The resulting set may have a different size to the original set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*UintSet) FlatMapToString added in v0.3.0

func (set *UintSet) FlatMapToString(f func(uint) []string) []string

FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*UintSet) Fold added in v0.9.0

func (set *UintSet) Fold(initial uint, fn func(uint, uint) uint) uint

Fold aggregates all the values in the set using a supplied function, starting from some initial value.

func (*UintSet) Forall added in v0.3.0

func (set *UintSet) Forall(p func(uint) bool) bool

Forall applies a predicate function p 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 (*UintSet) Foreach added in v0.3.0

func (set *UintSet) Foreach(f func(uint))

Foreach iterates over uintSet and executes the function f against each element.

func (*UintSet) GobDecode added in v0.3.0

func (set *UintSet) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this set type. You must register uint with the 'gob' package before this method is used.

func (UintSet) GobEncode added in v0.3.0

func (set UintSet) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this list type. You must register uint with the 'gob' package before this method is used.

func (*UintSet) Intersect added in v0.3.0

func (set *UintSet) Intersect(other *UintSet) *UintSet

Intersect returns a new set with items that exist only in both sets.

func (*UintSet) IsEmpty added in v0.3.0

func (set *UintSet) IsEmpty() bool

IsEmpty returns true if the set is empty.

func (*UintSet) IsSequence added in v0.3.0

func (set *UintSet) IsSequence() bool

IsSequence returns true for lists and queues.

func (*UintSet) IsSet added in v0.3.0

func (set *UintSet) IsSet() bool

IsSet returns false for lists or queues.

func (*UintSet) IsSubset added in v0.3.0

func (set *UintSet) IsSubset(other *UintSet) bool

IsSubset determines whether every item in the other set is in this set, returning true if so.

func (*UintSet) IsSuperset added in v0.3.0

func (set *UintSet) IsSuperset(other *UintSet) bool

IsSuperset determines whether every item of this set is in the other set, returning true if so.

func (*UintSet) Map added in v0.3.0

func (set *UintSet) Map(f func(uint) uint) *UintSet

Map returns a new UintSet by transforming every element with a function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*UintSet) MapToString added in v0.3.0

func (set *UintSet) MapToString(f func(uint) string) []string

MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*UintSet) MarshalJSON added in v0.3.0

func (set *UintSet) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON encoding for this set type.

func (*UintSet) Max added in v0.3.0

func (set *UintSet) Max() (result uint)

Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.

func (*UintSet) MaxBy added in v0.3.0

func (set *UintSet) MaxBy(less func(uint, uint) bool) uint

MaxBy returns an element of UintSet 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 (*UintSet) Min added in v0.3.0

func (set *UintSet) Min() uint

Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.

func (*UintSet) MinBy added in v0.3.0

func (set *UintSet) MinBy(less func(uint, uint) bool) uint

MinBy returns an element of UintSet 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 (*UintSet) MkString added in v0.3.0

func (set *UintSet) MkString(sep string) string

MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.

func (*UintSet) MkString3 added in v0.3.0

func (set *UintSet) MkString3(before, between, after string) string

MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.

func (*UintSet) NonEmpty added in v0.3.0

func (set *UintSet) NonEmpty() bool

NonEmpty returns true if the set is not empty.

func (*UintSet) Partition added in v0.3.0

func (set *UintSet) Partition(p func(uint) bool) (*UintSet, *UintSet)

Partition returns two new uintSets 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.

func (*UintSet) Remove added in v0.3.0

func (set *UintSet) Remove(i uint) *UintSet

Remove removes a single item from the set. A new set is returned that has all the elements except the removed one.

func (*UintSet) Send added in v0.3.0

func (set *UintSet) Send() <-chan uint

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 (*UintSet) Size added in v0.3.0

func (set *UintSet) Size() int

Size returns how many items are currently in the set. This is a synonym for Cardinality.

func (*UintSet) String added in v0.3.0

func (set *UintSet) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*UintSet) StringList added in v0.3.0

func (set *UintSet) StringList() []string

StringList gets a list of strings that depicts all the elements.

func (*UintSet) StringMap added in v0.3.0

func (set *UintSet) StringMap() map[string]bool

StringMap renders the set as a map of strings. The value of each item in the set becomes stringified as a key in the resulting map.

func (*UintSet) Sum added in v0.3.0

func (set *UintSet) Sum() uint

Sum returns the sum of all the elements in the set.

func (*UintSet) SymmetricDifference added in v0.3.0

func (set *UintSet) SymmetricDifference(other *UintSet) *UintSet

SymmetricDifference returns a new set with items in the current set or the other set but not in both.

func (*UintSet) ToInterfaceSlice added in v0.3.0

func (set *UintSet) ToInterfaceSlice() []interface{}

ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.

func (*UintSet) ToList added in v0.3.0

func (set *UintSet) ToList() *UintList

ToList returns the elements of the set as a list. The returned list is a shallow copy; the set is not altered.

func (*UintSet) ToSet added in v0.3.0

func (set *UintSet) ToSet() *UintSet

ToSet returns the set; this is an identity operation in this case.

func (*UintSet) ToSlice added in v0.3.0

func (set *UintSet) ToSlice() []uint

ToSlice returns the elements of the current set as a slice.

func (*UintSet) Union added in v0.3.0

func (set *UintSet) Union(other *UintSet) *UintSet

Union returns a new set with all items in both sets.

func (*UintSet) UnmarshalJSON added in v0.3.0

func (set *UintSet) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this set type.

type UintSizer added in v0.3.0

type UintSizer interface {
	// IsEmpty tests whether UintCollection is empty.
	IsEmpty() bool

	// NonEmpty tests whether UintCollection is empty.
	NonEmpty() bool

	// Size returns the number of items in the list - an alias of Len().
	Size() int
}

UintSizer defines an interface for sizing methods on uint collections.

type UintStringMap added in v0.3.0

type UintStringMap struct {
	// contains filtered or unexported fields
}

UintStringMap is the primary type that represents a thread-safe map

func NewUintStringMap added in v0.3.0

func NewUintStringMap(kv ...UintStringTuple) *UintStringMap

NewUintStringMap creates and returns a reference to a map, optionally containing some items.

func NewUintStringMap1 added in v0.3.0

func NewUintStringMap1(k uint, v string) *UintStringMap

NewUintStringMap1 creates and returns a reference to a map containing one item.

func (*UintStringMap) Clone added in v0.3.0

func (mm *UintStringMap) Clone() *UintStringMap

Clone returns the same map, which is immutable.

func (*UintStringMap) ContainsAllKeys added in v0.3.0

func (mm *UintStringMap) ContainsAllKeys(kk ...uint) bool

ContainsAllKeys determines if the given items are all in the map.

func (*UintStringMap) ContainsKey added in v0.3.0

func (mm *UintStringMap) ContainsKey(k uint) bool

ContainsKey determines if a given item is already in the map.

func (*UintStringMap) Equals added in v0.3.0

func (mm *UintStringMap) Equals(other *UintStringMap) bool

Equals determines if two maps 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 maps to be equal.

func (*UintStringMap) Exists added in v0.3.0

func (mm *UintStringMap) Exists(p func(uint, string) bool) bool

Exists applies the predicate p 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 (*UintStringMap) Filter added in v0.3.0

func (mm *UintStringMap) Filter(p func(uint, string) bool) *UintStringMap

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*UintStringMap) Find added in v0.3.0

func (mm *UintStringMap) Find(p func(uint, string) bool) (UintStringTuple, bool)

Find returns the first string that returns true for the predicate p. False is returned if none match.

func (*UintStringMap) FlatMap added in v0.3.0

func (mm *UintStringMap) FlatMap(f func(uint, string) []UintStringTuple) *UintStringMap

FlatMap returns a new StringMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*UintStringMap) Forall added in v0.3.0

func (mm *UintStringMap) Forall(f func(uint, string) bool) bool

Forall applies the predicate p 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 (*UintStringMap) Foreach added in v0.3.0

func (mm *UintStringMap) Foreach(f func(uint, string))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*UintStringMap) Get added in v0.3.0

func (mm *UintStringMap) Get(k uint) (string, bool)

Get returns one of the items in the map, if present.

func (*UintStringMap) GobDecode added in v0.3.0

func (mm *UintStringMap) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register string with the 'gob' package before this method is used.

func (*UintStringMap) GobEncode added in v0.3.0

func (mm *UintStringMap) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register string with the 'gob' package before this method is used.

func (*UintStringMap) IsEmpty added in v0.3.0

func (mm *UintStringMap) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*UintStringMap) Keys added in v0.3.0

func (mm *UintStringMap) Keys() collection.UintList

Keys returns the keys of the current map as a slice.

func (*UintStringMap) Map added in v0.3.0

func (mm *UintStringMap) Map(f func(uint, string) (uint, string)) *UintStringMap

Map returns a new StringMap by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*UintStringMap) MkString added in v0.3.0

func (mm *UintStringMap) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*UintStringMap) MkString4 added in v0.7.0

func (mm *UintStringMap) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*UintStringMap) NonEmpty added in v0.3.0

func (mm *UintStringMap) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*UintStringMap) OrderedSlice added in v0.6.0

func (mm *UintStringMap) OrderedSlice(keys collection.UintList) UintStringTuples

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*UintStringMap) Partition added in v0.3.0

func (mm *UintStringMap) Partition(p func(uint, string) bool) (matching *UintStringMap, others *UintStringMap)

Partition applies the predicate p 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.

func (*UintStringMap) Put added in v0.3.0

func (mm *UintStringMap) Put(k uint, v string) *UintStringMap

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*UintStringMap) Size added in v0.3.0

func (mm *UintStringMap) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*UintStringMap) String added in v0.3.0

func (mm *UintStringMap) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*UintStringMap) ToSlice added in v0.3.0

func (mm *UintStringMap) ToSlice() UintStringTuples

ToSlice returns the key/value pairs as a slice

func (*UintStringMap) Values added in v0.3.0

func (mm *UintStringMap) Values() collection.StringList

Values returns the values of the current map as a slice.

type UintStringTuple added in v0.3.0

type UintStringTuple struct {
	Key uint
	Val string
}

UintStringTuple represents a key/value pair.

func (UintStringTuple) MarshalJSON added in v0.6.0

func (t UintStringTuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (UintStringTuple) UnmarshalJSON added in v0.6.0

func (t UintStringTuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type UintStringTuples added in v0.3.0

type UintStringTuples []UintStringTuple

UintStringTuples can be used as a builder for unmodifiable maps.

func UintStringZip added in v0.3.0

func UintStringZip(keys ...uint) UintStringTuples

UintStringZip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewUintStringMap constructor function.

func (UintStringTuples) Append1 added in v0.3.0

func (ts UintStringTuples) Append1(k uint, v string) UintStringTuples

Append1 adds one item.

func (UintStringTuples) Append2 added in v0.3.0

func (ts UintStringTuples) Append2(k1 uint, v1 string, k2 uint, v2 string) UintStringTuples

Append2 adds two items.

func (UintStringTuples) Append3 added in v0.3.0

func (ts UintStringTuples) Append3(k1 uint, v1 string, k2 uint, v2 string, k3 uint, v3 string) UintStringTuples

Append3 adds three items.

func (UintStringTuples) MkString added in v0.6.0

func (ts UintStringTuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (UintStringTuples) MkString4 added in v0.7.0

func (ts UintStringTuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (UintStringTuples) String added in v0.6.0

func (ts UintStringTuples) String() string

func (UintStringTuples) ToMap added in v0.6.0

func (ts UintStringTuples) ToMap() *UintStringMap

ToMap converts the tuples to a map.

func (UintStringTuples) Values added in v0.3.0

func (ts UintStringTuples) Values(values ...string) UintStringTuples

Values sets the values in a tuple slice. Use this with UintStringZip.

type UintUintMap added in v0.3.0

type UintUintMap struct {
	// contains filtered or unexported fields
}

UintUintMap is the primary type that represents a thread-safe map

func NewUintUintMap added in v0.3.0

func NewUintUintMap(kv ...UintUintTuple) *UintUintMap

NewUintUintMap creates and returns a reference to a map, optionally containing some items.

func NewUintUintMap1 added in v0.3.0

func NewUintUintMap1(k uint, v uint) *UintUintMap

NewUintUintMap1 creates and returns a reference to a map containing one item.

func (*UintUintMap) Clone added in v0.3.0

func (mm *UintUintMap) Clone() *UintUintMap

Clone returns the same map, which is immutable.

func (*UintUintMap) ContainsAllKeys added in v0.3.0

func (mm *UintUintMap) ContainsAllKeys(kk ...uint) bool

ContainsAllKeys determines if the given items are all in the map.

func (*UintUintMap) ContainsKey added in v0.3.0

func (mm *UintUintMap) ContainsKey(k uint) bool

ContainsKey determines if a given item is already in the map.

func (*UintUintMap) Equals added in v0.3.0

func (mm *UintUintMap) Equals(other *UintUintMap) bool

Equals determines if two maps 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 maps to be equal.

func (*UintUintMap) Exists added in v0.3.0

func (mm *UintUintMap) Exists(p func(uint, uint) bool) bool

Exists applies the predicate p 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 (*UintUintMap) Filter added in v0.3.0

func (mm *UintUintMap) Filter(p func(uint, uint) bool) *UintUintMap

Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.

func (*UintUintMap) Find added in v0.3.0

func (mm *UintUintMap) Find(p func(uint, uint) bool) (UintUintTuple, bool)

Find returns the first uint that returns true for the predicate p. False is returned if none match.

func (*UintUintMap) FlatMap added in v0.3.0

func (mm *UintUintMap) FlatMap(f func(uint, uint) []UintUintTuple) *UintUintMap

FlatMap returns a new UintMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*UintUintMap) Forall added in v0.3.0

func (mm *UintUintMap) Forall(f func(uint, uint) bool) bool

Forall applies the predicate p 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 (*UintUintMap) Foreach added in v0.3.0

func (mm *UintUintMap) Foreach(f func(uint, uint))

Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.

func (*UintUintMap) Get added in v0.3.0

func (mm *UintUintMap) Get(k uint) (uint, bool)

Get returns one of the items in the map, if present.

func (*UintUintMap) GobDecode added in v0.3.0

func (mm *UintUintMap) GobDecode(b []byte) error

GobDecode implements 'gob' decoding for this map type. You must register uint with the 'gob' package before this method is used.

func (*UintUintMap) GobEncode added in v0.3.0

func (mm *UintUintMap) GobEncode() ([]byte, error)

GobEncode implements 'gob' encoding for this map type. You must register uint with the 'gob' package before this method is used.

func (*UintUintMap) IsEmpty added in v0.3.0

func (mm *UintUintMap) IsEmpty() bool

IsEmpty returns true if the map is empty.

func (*UintUintMap) Keys added in v0.3.0

func (mm *UintUintMap) Keys() collection.UintList

Keys returns the keys of the current map as a slice.

func (*UintUintMap) Map added in v0.3.0

func (mm *UintUintMap) Map(f func(uint, uint) (uint, uint)) *UintUintMap

Map returns a new UintMap by transforming every element with the function f.

This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.

func (*UintUintMap) MkString added in v0.3.0

func (mm *UintUintMap) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (*UintUintMap) MkString4 added in v0.7.0

func (mm *UintUintMap) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (*UintUintMap) NonEmpty added in v0.3.0

func (mm *UintUintMap) NonEmpty() bool

NonEmpty returns true if the map is not empty.

func (*UintUintMap) OrderedSlice added in v0.6.0

func (mm *UintUintMap) OrderedSlice(keys collection.UintList) UintUintTuples

OrderedSlice returns the key/value pairs as a slice in the order specified by keys.

func (*UintUintMap) Partition added in v0.3.0

func (mm *UintUintMap) Partition(p func(uint, uint) bool) (matching *UintUintMap, others *UintUintMap)

Partition applies the predicate p 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.

func (*UintUintMap) Put added in v0.3.0

func (mm *UintUintMap) Put(k uint, v uint) *UintUintMap

Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.

func (*UintUintMap) Size added in v0.3.0

func (mm *UintUintMap) Size() int

Size returns how many items are currently in the map. This is a synonym for Len.

func (*UintUintMap) String added in v0.3.0

func (mm *UintUintMap) String() string

String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.

func (*UintUintMap) ToSlice added in v0.3.0

func (mm *UintUintMap) ToSlice() UintUintTuples

ToSlice returns the key/value pairs as a slice

func (*UintUintMap) Values added in v0.3.0

func (mm *UintUintMap) Values() collection.UintList

Values returns the values of the current map as a slice.

type UintUintTuple added in v0.3.0

type UintUintTuple struct {
	Key uint
	Val uint
}

UintUintTuple represents a key/value pair.

func (UintUintTuple) MarshalJSON added in v0.6.0

func (t UintUintTuple) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.Marshaler interface.

func (UintUintTuple) UnmarshalJSON added in v0.6.0

func (t UintUintTuple) UnmarshalJSON(b []byte) error

UnmarshalJSON implements JSON decoding for this tuple type.

type UintUintTuples added in v0.3.0

type UintUintTuples []UintUintTuple

UintUintTuples can be used as a builder for unmodifiable maps.

func UintUintZip added in v0.3.0

func UintUintZip(keys ...uint) UintUintTuples

UintUintZip is used with the Values method to zip (i.e. interleave) a slice of keys with a slice of values. These can then be passed in to the NewUintUintMap constructor function.

func (UintUintTuples) Append1 added in v0.3.0

func (ts UintUintTuples) Append1(k uint, v uint) UintUintTuples

Append1 adds one item.

func (UintUintTuples) Append2 added in v0.3.0

func (ts UintUintTuples) Append2(k1 uint, v1 uint, k2 uint, v2 uint) UintUintTuples

Append2 adds two items.

func (UintUintTuples) Append3 added in v0.3.0

func (ts UintUintTuples) Append3(k1 uint, v1 uint, k2 uint, v2 uint, k3 uint, v3 uint) UintUintTuples

Append3 adds three items.

func (UintUintTuples) MkString added in v0.6.0

func (ts UintUintTuples) MkString(sep string) string

MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.

func (UintUintTuples) MkString4 added in v0.7.0

func (ts UintUintTuples) MkString4(before, between, after, equals string) string

MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.

func (UintUintTuples) String added in v0.6.0

func (ts UintUintTuples) String() string

func (UintUintTuples) ToMap added in v0.6.0

func (ts UintUintTuples) ToMap() *UintUintMap

ToMap converts the tuples to a map.

func (UintUintTuples) Values added in v0.3.0

func (ts UintUintTuples) Values(values ...uint) UintUintTuples

Values sets the values in a tuple slice. Use this with UintUintZip.

Jump to

Keyboard shortcuts

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