Documentation
¶
Overview ¶
package collection provides lightweight collection types for core Go built-in types. These are not safe for sharing across multiple goroutines.
Index ¶
- type AnyCollection
- type AnyList
- func (list AnyList) Clone() AnyList
- func (list AnyList) Contains(v interface{}) bool
- func (list AnyList) ContainsAll(i ...interface{}) bool
- func (list AnyList) CountBy(p func(interface{}) bool) (result int)
- func (list AnyList) DistinctBy(equal func(interface{}, interface{}) bool) AnyList
- func (list AnyList) DoReverse() AnyList
- func (list AnyList) DoShuffle() AnyList
- func (list AnyList) Drop(n int) AnyList
- func (list AnyList) DropLast(n int) AnyList
- func (list AnyList) DropWhile(p func(interface{}) bool) AnyList
- func (list AnyList) Equals(other AnyList) bool
- func (list AnyList) Exists(p func(interface{}) bool) bool
- func (list AnyList) Filter(p func(interface{}) bool) AnyList
- func (list AnyList) Find(p func(interface{}) bool) (interface{}, bool)
- func (list AnyList) FlatMap(f func(interface{}) []interface{}) AnyList
- func (list AnyList) Fold(initial interface{}, fn func(interface{}, interface{}) interface{}) interface{}
- func (list AnyList) Forall(p func(interface{}) bool) bool
- func (list AnyList) Foreach(f func(interface{}))
- func (list AnyList) Get(i int) interface{}
- func (list AnyList) GobDecode(b []byte) error
- func (list AnyList) GobEncode() ([]byte, error)
- func (list AnyList) Head() interface{}
- func (list AnyList) HeadOption() (interface{}, bool)
- func (list AnyList) IndexWhere(p func(interface{}) bool) int
- func (list AnyList) IndexWhere2(p func(interface{}) bool, from int) int
- func (list AnyList) Init() AnyList
- func (list AnyList) IsEmpty() bool
- func (list AnyList) IsSequence() bool
- func (list AnyList) IsSet() bool
- func (list AnyList) Last() interface{}
- func (list AnyList) LastIndexWhere(p func(interface{}) bool) int
- func (list AnyList) LastIndexWhere2(p func(interface{}) bool, before int) int
- func (list AnyList) LastOption() (interface{}, bool)
- func (list AnyList) Len() int
- func (list AnyList) Map(f func(interface{}) interface{}) AnyList
- func (list AnyList) MaxBy(less func(interface{}, interface{}) bool) interface{}
- func (list AnyList) MinBy(less func(interface{}, interface{}) bool) interface{}
- func (list AnyList) MkString(sep string) string
- func (list AnyList) MkString3(before, between, after string) string
- func (list AnyList) NonEmpty() bool
- func (list AnyList) Partition(p func(interface{}) bool) (AnyList, AnyList)
- func (list AnyList) Reverse() AnyList
- func (list AnyList) Send() <-chan interface{}
- func (list AnyList) Shuffle() AnyList
- func (list AnyList) Size() int
- func (list AnyList) SortBy(less func(i, j interface{}) bool) AnyList
- func (list AnyList) StableSortBy(less func(i, j interface{}) bool) AnyList
- func (list AnyList) String() string
- func (list AnyList) StringList() []string
- func (list AnyList) Swap(i, j int)
- func (list AnyList) Tail() AnyList
- func (list AnyList) Take(n int) AnyList
- func (list AnyList) TakeLast(n int) AnyList
- func (list AnyList) TakeWhile(p func(interface{}) bool) AnyList
- func (list AnyList) ToInterfaceSlice() []interface{}
- func (list AnyList) ToList() AnyList
- func (list AnyList) ToSet() AnySet
- func (list AnyList) ToSlice() []interface{}
- type AnyMkStringer
- type AnyQueue
- func (queue *AnyQueue) Add(more ...interface{})
- func (queue *AnyQueue) Cap() int
- func (queue *AnyQueue) Clear()
- func (queue *AnyQueue) Clone() *AnyQueue
- func (queue *AnyQueue) Contains(v interface{}) bool
- func (queue *AnyQueue) ContainsAll(i ...interface{}) bool
- func (queue *AnyQueue) CountBy(p func(interface{}) bool) (result int)
- func (queue *AnyQueue) DoKeepWhere(p func(interface{}) bool) *AnyQueue
- func (queue *AnyQueue) Equals(other *AnyQueue) bool
- func (queue *AnyQueue) Exists(p func(interface{}) bool) bool
- func (queue *AnyQueue) Filter(p func(interface{}) bool) *AnyQueue
- func (queue *AnyQueue) Find(p func(interface{}) bool) (interface{}, bool)
- func (queue *AnyQueue) FlatMap(f func(interface{}) []interface{}) *AnyQueue
- func (queue *AnyQueue) Fold(initial interface{}, fn func(interface{}, interface{}) interface{}) interface{}
- func (queue *AnyQueue) Forall(p func(interface{}) bool) bool
- func (queue *AnyQueue) Foreach(f func(interface{}))
- func (queue *AnyQueue) Get(i int) interface{}
- func (queue *AnyQueue) Head() interface{}
- func (queue *AnyQueue) HeadOption() (interface{}, bool)
- func (queue *AnyQueue) IsEmpty() bool
- func (queue *AnyQueue) IsFull() bool
- func (queue *AnyQueue) IsOverwriting() bool
- func (queue *AnyQueue) IsSequence() bool
- func (queue *AnyQueue) IsSet() bool
- func (queue *AnyQueue) Last() interface{}
- func (queue *AnyQueue) LastOption() (interface{}, bool)
- func (queue *AnyQueue) Len() int
- func (queue *AnyQueue) Less(i, j int) bool
- func (queue *AnyQueue) Map(f func(interface{}) interface{}) *AnyQueue
- func (queue AnyQueue) MarshalJSON() ([]byte, error)
- func (queue *AnyQueue) MaxBy(less func(interface{}, interface{}) bool) interface{}
- func (queue *AnyQueue) MinBy(less func(interface{}, interface{}) bool) interface{}
- func (queue *AnyQueue) MkString(sep string) string
- func (queue *AnyQueue) MkString3(before, between, after string) string
- func (queue *AnyQueue) NonEmpty() bool
- func (queue *AnyQueue) Offer(items ...interface{}) []interface{}
- func (queue *AnyQueue) Partition(p func(interface{}) bool) (*AnyQueue, *AnyQueue)
- func (queue *AnyQueue) Pop(n int) []interface{}
- func (queue *AnyQueue) Pop1() (interface{}, bool)
- func (queue *AnyQueue) Push(items ...interface{}) *AnyQueue
- func (queue *AnyQueue) Reallocate(capacity int, overwrite bool) *AnyQueue
- func (queue *AnyQueue) Send() <-chan interface{}
- func (queue *AnyQueue) Size() int
- func (queue *AnyQueue) Sort()
- func (queue *AnyQueue) Space() int
- func (queue *AnyQueue) StableSort()
- func (queue *AnyQueue) String() string
- func (queue *AnyQueue) StringList() []string
- func (queue *AnyQueue) Swap(i, j int)
- func (queue *AnyQueue) ToInterfaceSlice() []interface{}
- func (queue *AnyQueue) ToSlice() []interface{}
- func (queue *AnyQueue) UnmarshalJSON(b []byte) error
- type AnySequence
- type AnySet
- func (set AnySet) Add(more ...interface{}) AnySet
- func (set AnySet) Append(more ...interface{}) AnySet
- func (set AnySet) Cardinality() int
- func (set *AnySet) Clear()
- func (set AnySet) Clone() AnySet
- func (set AnySet) Contains(i interface{}) bool
- func (set AnySet) ContainsAll(i ...interface{}) bool
- func (set AnySet) CountBy(p func(interface{}) bool) (result int)
- func (set AnySet) Difference(other AnySet) AnySet
- func (set AnySet) Equals(other AnySet) bool
- func (set AnySet) Exists(p func(interface{}) bool) bool
- func (set AnySet) Filter(p func(interface{}) bool) AnySet
- func (set AnySet) Find(p func(interface{}) bool) (interface{}, bool)
- func (set AnySet) FlatMap(f func(interface{}) []interface{}) AnySet
- func (set AnySet) Fold(initial interface{}, fn func(interface{}, interface{}) interface{}) interface{}
- func (set AnySet) Forall(p func(interface{}) bool) bool
- func (set AnySet) Foreach(f func(interface{}))
- func (set AnySet) Intersect(other AnySet) AnySet
- func (set AnySet) IsEmpty() bool
- func (set AnySet) IsSequence() bool
- func (set AnySet) IsSet() bool
- func (set AnySet) IsSubset(other AnySet) bool
- func (set AnySet) IsSuperset(other AnySet) bool
- func (set AnySet) Map(f func(interface{}) interface{}) AnySet
- func (set AnySet) MarshalJSON() ([]byte, error)
- func (set AnySet) MaxBy(less func(interface{}, interface{}) bool) interface{}
- func (set AnySet) MinBy(less func(interface{}, interface{}) bool) interface{}
- func (set AnySet) MkString(sep string) string
- func (set AnySet) MkString3(before, between, after string) string
- func (set AnySet) NonEmpty() bool
- func (set AnySet) Partition(p func(interface{}) bool) (AnySet, AnySet)
- func (set AnySet) Remove(i interface{})
- func (set AnySet) Send() <-chan interface{}
- func (set AnySet) Size() int
- func (set AnySet) String() string
- func (set AnySet) StringList() []string
- func (set AnySet) StringMap() map[string]bool
- func (set AnySet) SymmetricDifference(other AnySet) AnySet
- func (set AnySet) ToInterfaceSlice() []interface{}
- func (set AnySet) ToList() AnyList
- func (set AnySet) ToSet() AnySet
- func (set AnySet) ToSlice() []interface{}
- func (set AnySet) Union(other AnySet) AnySet
- func (set AnySet) UnmarshalJSON(b []byte) error
- type AnySizer
- type Int64Collection
- type Int64Int64Map
- func (mm *Int64Int64Map) Clear()
- func (mm Int64Int64Map) Clone() Int64Int64Map
- func (mm Int64Int64Map) ContainsAllKeys(kk ...int64) bool
- func (mm Int64Int64Map) ContainsKey(k int64) bool
- func (mm Int64Int64Map) DropWhere(fn func(int64, int64) bool) Int64Int64Tuples
- func (mm Int64Int64Map) Equals(other Int64Int64Map) bool
- func (mm Int64Int64Map) Exists(p func(int64, int64) bool) bool
- func (mm Int64Int64Map) Filter(p func(int64, int64) bool) Int64Int64Map
- func (mm Int64Int64Map) Find(p func(int64, int64) bool) (Int64Int64Tuple, bool)
- func (mm Int64Int64Map) FlatMap(f func(int64, int64) []Int64Int64Tuple) Int64Int64Map
- func (mm Int64Int64Map) Forall(p func(int64, int64) bool) bool
- func (mm Int64Int64Map) Foreach(f func(int64, int64))
- func (mm Int64Int64Map) Get(k int64) (int64, bool)
- func (mm Int64Int64Map) IsEmpty() bool
- func (mm Int64Int64Map) Keys() Int64List
- func (mm Int64Int64Map) Map(f func(int64, int64) (int64, int64)) Int64Int64Map
- func (mm Int64Int64Map) MkString(sep string) string
- func (mm Int64Int64Map) MkString4(before, between, after, equals string) string
- func (mm Int64Int64Map) NonEmpty() bool
- func (mm Int64Int64Map) OrderedSlice(keys Int64List) Int64Int64Tuples
- func (mm Int64Int64Map) Partition(p func(int64, int64) bool) (matching Int64Int64Map, others Int64Int64Map)
- func (mm Int64Int64Map) Pop(k int64) (int64, bool)
- func (mm Int64Int64Map) Put(k int64, v int64) bool
- func (mm Int64Int64Map) Remove(k int64)
- func (mm Int64Int64Map) Size() int
- func (mm Int64Int64Map) String() string
- func (mm Int64Int64Map) ToSlice() Int64Int64Tuples
- func (mm Int64Int64Map) Values() Int64List
- type Int64Int64Tuple
- type Int64Int64Tuples
- func (ts Int64Int64Tuples) Append1(k int64, v int64) Int64Int64Tuples
- func (ts Int64Int64Tuples) Append2(k1 int64, v1 int64, k2 int64, v2 int64) Int64Int64Tuples
- func (ts Int64Int64Tuples) Append3(k1 int64, v1 int64, k2 int64, v2 int64, k3 int64, v3 int64) Int64Int64Tuples
- func (ts Int64Int64Tuples) MkString(sep string) string
- func (ts Int64Int64Tuples) MkString4(before, between, after, equals string) string
- func (ts Int64Int64Tuples) String() string
- func (ts Int64Int64Tuples) ToMap() Int64Int64Map
- func (ts Int64Int64Tuples) Values(values ...int64) Int64Int64Tuples
- type Int64List
- func (list Int64List) Clone() Int64List
- func (list Int64List) Contains(v int64) bool
- func (list Int64List) ContainsAll(i ...int64) bool
- func (list Int64List) CountBy(p func(int64) bool) (result int)
- func (list Int64List) DistinctBy(equal func(int64, int64) bool) Int64List
- func (list Int64List) DoReverse() Int64List
- func (list Int64List) DoShuffle() Int64List
- func (list Int64List) Drop(n int) Int64List
- func (list Int64List) DropLast(n int) Int64List
- func (list Int64List) DropWhile(p func(int64) bool) Int64List
- func (list Int64List) Equals(other Int64List) bool
- func (list Int64List) Exists(p func(int64) bool) bool
- func (list Int64List) Filter(p func(int64) bool) Int64List
- func (list Int64List) Find(p func(int64) bool) (int64, bool)
- func (list Int64List) FlatMap(f func(int64) []int64) Int64List
- func (list Int64List) FlatMapToString(f func(int64) []string) []string
- func (list Int64List) Fold(initial int64, fn func(int64, int64) int64) int64
- func (list Int64List) Forall(p func(int64) bool) bool
- func (list Int64List) Foreach(f func(int64))
- func (list Int64List) Get(i int) int64
- func (list Int64List) GobDecode(b []byte) error
- func (list Int64List) GobEncode() ([]byte, error)
- func (list Int64List) Head() int64
- func (list Int64List) HeadOption() (int64, bool)
- func (list Int64List) IndexWhere(p func(int64) bool) int
- func (list Int64List) IndexWhere2(p func(int64) bool, from int) int
- func (list Int64List) Init() Int64List
- func (list Int64List) IsEmpty() bool
- func (list Int64List) IsSequence() bool
- func (list Int64List) IsSet() bool
- func (list Int64List) Last() int64
- func (list Int64List) LastIndexWhere(p func(int64) bool) int
- func (list Int64List) LastIndexWhere2(p func(int64) bool, before int) int
- func (list Int64List) LastOption() (int64, bool)
- func (list Int64List) Len() int
- func (list Int64List) Map(f func(int64) int64) Int64List
- func (list Int64List) MapToString(f func(int64) string) []string
- func (list Int64List) Max() (result int64)
- func (list Int64List) MaxBy(less func(int64, int64) bool) int64
- func (list Int64List) Min() int64
- func (list Int64List) MinBy(less func(int64, int64) bool) int64
- func (list Int64List) MkString(sep string) string
- func (list Int64List) MkString3(before, between, after string) string
- func (list Int64List) NonEmpty() bool
- func (list Int64List) Partition(p func(int64) bool) (Int64List, Int64List)
- func (list Int64List) Reverse() Int64List
- func (list Int64List) Send() <-chan int64
- func (list Int64List) Shuffle() Int64List
- func (list Int64List) Size() int
- func (list Int64List) SortBy(less func(i, j int64) bool) Int64List
- func (list Int64List) Sorted() Int64List
- func (list Int64List) StableSortBy(less func(i, j int64) bool) Int64List
- func (list Int64List) StableSorted() Int64List
- func (list Int64List) String() string
- func (list Int64List) StringList() []string
- func (list Int64List) Sum() int64
- func (list Int64List) Swap(i, j int)
- func (list Int64List) Tail() Int64List
- func (list Int64List) Take(n int) Int64List
- func (list Int64List) TakeLast(n int) Int64List
- func (list Int64List) TakeWhile(p func(int64) bool) Int64List
- func (list Int64List) ToInterfaceSlice() []interface{}
- func (list Int64List) ToList() Int64List
- func (list Int64List) ToSet() Int64Set
- func (list Int64List) ToSlice() []int64
- type Int64MkStringer
- type Int64Queue
- func (queue *Int64Queue) Add(more ...int64)
- func (queue *Int64Queue) Cap() int
- func (queue *Int64Queue) Clear()
- func (queue *Int64Queue) Clone() *Int64Queue
- func (queue *Int64Queue) Contains(v int64) bool
- func (queue *Int64Queue) ContainsAll(i ...int64) bool
- func (queue *Int64Queue) CountBy(p func(int64) bool) (result int)
- func (queue *Int64Queue) DoKeepWhere(p func(int64) bool) *Int64Queue
- func (queue *Int64Queue) Equals(other *Int64Queue) bool
- func (queue *Int64Queue) Exists(p func(int64) bool) bool
- func (queue *Int64Queue) Filter(p func(int64) bool) *Int64Queue
- func (queue *Int64Queue) Find(p func(int64) bool) (int64, bool)
- func (queue *Int64Queue) FlatMap(f func(int64) []int64) *Int64Queue
- func (queue *Int64Queue) FlatMapToString(f func(int64) []string) []string
- func (queue *Int64Queue) Fold(initial int64, fn func(int64, int64) int64) int64
- func (queue *Int64Queue) Forall(p func(int64) bool) bool
- func (queue *Int64Queue) Foreach(f func(int64))
- func (queue *Int64Queue) Get(i int) int64
- func (queue *Int64Queue) Head() int64
- func (queue *Int64Queue) HeadOption() (int64, bool)
- func (queue *Int64Queue) IsEmpty() bool
- func (queue *Int64Queue) IsFull() bool
- func (queue *Int64Queue) IsOverwriting() bool
- func (queue *Int64Queue) IsSequence() bool
- func (queue *Int64Queue) IsSet() bool
- func (queue *Int64Queue) Last() int64
- func (queue *Int64Queue) LastOption() (int64, bool)
- func (queue *Int64Queue) Len() int
- func (queue *Int64Queue) Less(i, j int) bool
- func (queue *Int64Queue) Map(f func(int64) int64) *Int64Queue
- func (queue *Int64Queue) MapToString(f func(int64) string) []string
- func (queue Int64Queue) MarshalJSON() ([]byte, error)
- func (queue *Int64Queue) Max() (result int64)
- func (queue *Int64Queue) MaxBy(less func(int64, int64) bool) int64
- func (queue *Int64Queue) Min() int64
- func (queue *Int64Queue) MinBy(less func(int64, int64) bool) int64
- func (queue *Int64Queue) MkString(sep string) string
- func (queue *Int64Queue) MkString3(before, between, after string) string
- func (queue *Int64Queue) NonEmpty() bool
- func (queue *Int64Queue) Offer(items ...int64) []int64
- func (queue *Int64Queue) Partition(p func(int64) bool) (*Int64Queue, *Int64Queue)
- func (queue *Int64Queue) Pop(n int) []int64
- func (queue *Int64Queue) Pop1() (int64, bool)
- func (queue *Int64Queue) Push(items ...int64) *Int64Queue
- func (queue *Int64Queue) Reallocate(capacity int, overwrite bool) *Int64Queue
- func (queue *Int64Queue) Send() <-chan int64
- func (queue *Int64Queue) Size() int
- func (queue *Int64Queue) Sort()
- func (queue *Int64Queue) Space() int
- func (queue *Int64Queue) StableSort()
- func (queue *Int64Queue) String() string
- func (queue *Int64Queue) StringList() []string
- func (queue *Int64Queue) Sum() int64
- func (queue *Int64Queue) Swap(i, j int)
- func (queue *Int64Queue) ToInterfaceSlice() []interface{}
- func (queue *Int64Queue) ToSlice() []int64
- func (queue *Int64Queue) UnmarshalJSON(b []byte) error
- type Int64Sequence
- type Int64Set
- func (set Int64Set) Add(more ...int64) Int64Set
- func (set Int64Set) Append(more ...int64) Int64Set
- func (set Int64Set) Cardinality() int
- func (set *Int64Set) Clear()
- func (set Int64Set) Clone() Int64Set
- func (set Int64Set) Contains(i int64) bool
- func (set Int64Set) ContainsAll(i ...int64) bool
- func (set Int64Set) CountBy(p func(int64) bool) (result int)
- func (set Int64Set) Difference(other Int64Set) Int64Set
- func (set Int64Set) Equals(other Int64Set) bool
- func (set Int64Set) Exists(p func(int64) bool) bool
- func (set Int64Set) Filter(p func(int64) bool) Int64Set
- func (set Int64Set) Find(p func(int64) bool) (int64, bool)
- func (set Int64Set) FlatMap(f func(int64) []int64) Int64Set
- func (set Int64Set) FlatMapToString(f func(int64) []string) []string
- func (set Int64Set) Fold(initial int64, fn func(int64, int64) int64) int64
- func (set Int64Set) Forall(p func(int64) bool) bool
- func (set Int64Set) Foreach(f func(int64))
- func (set Int64Set) Intersect(other Int64Set) Int64Set
- func (set Int64Set) IsEmpty() bool
- func (set Int64Set) IsSequence() bool
- func (set Int64Set) IsSet() bool
- func (set Int64Set) IsSubset(other Int64Set) bool
- func (set Int64Set) IsSuperset(other Int64Set) bool
- func (set Int64Set) Map(f func(int64) int64) Int64Set
- func (set Int64Set) MapToString(f func(int64) string) []string
- func (set Int64Set) MarshalJSON() ([]byte, error)
- func (set Int64Set) Max() int64
- func (set Int64Set) MaxBy(less func(int64, int64) bool) int64
- func (set Int64Set) Min() int64
- func (set Int64Set) MinBy(less func(int64, int64) bool) int64
- func (set Int64Set) MkString(sep string) string
- func (set Int64Set) MkString3(before, between, after string) string
- func (set Int64Set) NonEmpty() bool
- func (set Int64Set) Partition(p func(int64) bool) (Int64Set, Int64Set)
- func (set Int64Set) Remove(i int64)
- func (set Int64Set) Send() <-chan int64
- func (set Int64Set) Size() int
- func (set Int64Set) String() string
- func (set Int64Set) StringList() []string
- func (set Int64Set) StringMap() map[string]bool
- func (set Int64Set) Sum() int64
- func (set Int64Set) SymmetricDifference(other Int64Set) Int64Set
- func (set Int64Set) ToInterfaceSlice() []interface{}
- func (set Int64Set) ToList() Int64List
- func (set Int64Set) ToSet() Int64Set
- func (set Int64Set) ToSlice() []int64
- func (set Int64Set) Union(other Int64Set) Int64Set
- func (set Int64Set) UnmarshalJSON(b []byte) error
- type Int64Sizer
- type Int64StringMap
- func (mm *Int64StringMap) Clear()
- func (mm Int64StringMap) Clone() Int64StringMap
- func (mm Int64StringMap) ContainsAllKeys(kk ...int64) bool
- func (mm Int64StringMap) ContainsKey(k int64) bool
- func (mm Int64StringMap) DropWhere(fn func(int64, string) bool) Int64StringTuples
- func (mm Int64StringMap) Equals(other Int64StringMap) bool
- func (mm Int64StringMap) Exists(p func(int64, string) bool) bool
- func (mm Int64StringMap) Filter(p func(int64, string) bool) Int64StringMap
- func (mm Int64StringMap) Find(p func(int64, string) bool) (Int64StringTuple, bool)
- func (mm Int64StringMap) FlatMap(f func(int64, string) []Int64StringTuple) Int64StringMap
- func (mm Int64StringMap) Forall(p func(int64, string) bool) bool
- func (mm Int64StringMap) Foreach(f func(int64, string))
- func (mm Int64StringMap) Get(k int64) (string, bool)
- func (mm Int64StringMap) IsEmpty() bool
- func (mm Int64StringMap) Keys() Int64List
- func (mm Int64StringMap) Map(f func(int64, string) (int64, string)) Int64StringMap
- func (mm Int64StringMap) MkString(sep string) string
- func (mm Int64StringMap) MkString4(before, between, after, equals string) string
- func (mm Int64StringMap) NonEmpty() bool
- func (mm Int64StringMap) OrderedSlice(keys Int64List) Int64StringTuples
- func (mm Int64StringMap) Partition(p func(int64, string) bool) (matching Int64StringMap, others Int64StringMap)
- func (mm Int64StringMap) Pop(k int64) (string, bool)
- func (mm Int64StringMap) Put(k int64, v string) bool
- func (mm Int64StringMap) Remove(k int64)
- func (mm Int64StringMap) Size() int
- func (mm Int64StringMap) String() string
- func (mm Int64StringMap) ToSlice() Int64StringTuples
- func (mm Int64StringMap) Values() StringList
- type Int64StringTuple
- type Int64StringTuples
- func (ts Int64StringTuples) Append1(k int64, v string) Int64StringTuples
- func (ts Int64StringTuples) Append2(k1 int64, v1 string, k2 int64, v2 string) Int64StringTuples
- func (ts Int64StringTuples) Append3(k1 int64, v1 string, k2 int64, v2 string, k3 int64, v3 string) Int64StringTuples
- func (ts Int64StringTuples) MkString(sep string) string
- func (ts Int64StringTuples) MkString4(before, between, after, equals string) string
- func (ts Int64StringTuples) String() string
- func (ts Int64StringTuples) ToMap() Int64StringMap
- func (ts Int64StringTuples) Values(values ...string) Int64StringTuples
- type IntCollection
- type IntIntMap
- func (mm *IntIntMap) Clear()
- func (mm IntIntMap) Clone() IntIntMap
- func (mm IntIntMap) ContainsAllKeys(kk ...int) bool
- func (mm IntIntMap) ContainsKey(k int) bool
- func (mm IntIntMap) DropWhere(fn func(int, int) bool) IntIntTuples
- func (mm IntIntMap) Equals(other IntIntMap) bool
- func (mm IntIntMap) Exists(p func(int, int) bool) bool
- func (mm IntIntMap) Filter(p func(int, int) bool) IntIntMap
- func (mm IntIntMap) Find(p func(int, int) bool) (IntIntTuple, bool)
- func (mm IntIntMap) FlatMap(f func(int, int) []IntIntTuple) IntIntMap
- func (mm IntIntMap) Forall(p func(int, int) bool) bool
- func (mm IntIntMap) Foreach(f func(int, int))
- func (mm IntIntMap) Get(k int) (int, bool)
- func (mm IntIntMap) IsEmpty() bool
- func (mm IntIntMap) Keys() IntList
- func (mm IntIntMap) Map(f func(int, int) (int, int)) IntIntMap
- func (mm IntIntMap) MkString(sep string) string
- func (mm IntIntMap) MkString4(before, between, after, equals string) string
- func (mm IntIntMap) NonEmpty() bool
- func (mm IntIntMap) OrderedSlice(keys IntList) IntIntTuples
- func (mm IntIntMap) Partition(p func(int, int) bool) (matching IntIntMap, others IntIntMap)
- func (mm IntIntMap) Pop(k int) (int, bool)
- func (mm IntIntMap) Put(k int, v int) bool
- func (mm IntIntMap) Remove(k int)
- func (mm IntIntMap) Size() int
- func (mm IntIntMap) String() string
- func (mm IntIntMap) ToSlice() IntIntTuples
- func (mm IntIntMap) Values() IntList
- type IntIntTuple
- type IntIntTuples
- func (ts IntIntTuples) Append1(k int, v int) IntIntTuples
- func (ts IntIntTuples) Append2(k1 int, v1 int, k2 int, v2 int) IntIntTuples
- func (ts IntIntTuples) Append3(k1 int, v1 int, k2 int, v2 int, k3 int, v3 int) IntIntTuples
- func (ts IntIntTuples) MkString(sep string) string
- func (ts IntIntTuples) MkString4(before, between, after, equals string) string
- func (ts IntIntTuples) String() string
- func (ts IntIntTuples) ToMap() IntIntMap
- func (ts IntIntTuples) Values(values ...int) IntIntTuples
- type IntList
- func (list IntList) Clone() IntList
- func (list IntList) Contains(v int) bool
- func (list IntList) ContainsAll(i ...int) bool
- func (list IntList) CountBy(p func(int) bool) (result int)
- func (list IntList) DistinctBy(equal func(int, int) bool) IntList
- func (list IntList) DoReverse() IntList
- func (list IntList) DoShuffle() IntList
- func (list IntList) Drop(n int) IntList
- func (list IntList) DropLast(n int) IntList
- func (list IntList) DropWhile(p func(int) bool) IntList
- func (list IntList) Equals(other IntList) bool
- func (list IntList) Exists(p func(int) bool) bool
- func (list IntList) Filter(p func(int) bool) IntList
- func (list IntList) Find(p func(int) bool) (int, bool)
- func (list IntList) FlatMap(f func(int) []int) IntList
- func (list IntList) FlatMapToString(f func(int) []string) []string
- func (list IntList) Fold(initial int, fn func(int, int) int) int
- func (list IntList) Forall(p func(int) bool) bool
- func (list IntList) Foreach(f func(int))
- func (list IntList) Get(i int) int
- func (list IntList) GobDecode(b []byte) error
- func (list IntList) GobEncode() ([]byte, error)
- func (list IntList) Head() int
- func (list IntList) HeadOption() (int, bool)
- func (list IntList) IndexWhere(p func(int) bool) int
- func (list IntList) IndexWhere2(p func(int) bool, from int) int
- func (list IntList) Init() IntList
- func (list IntList) IsEmpty() bool
- func (list IntList) IsSequence() bool
- func (list IntList) IsSet() bool
- func (list IntList) Last() int
- func (list IntList) LastIndexWhere(p func(int) bool) int
- func (list IntList) LastIndexWhere2(p func(int) bool, before int) int
- func (list IntList) LastOption() (int, bool)
- func (list IntList) Len() int
- func (list IntList) Map(f func(int) int) IntList
- func (list IntList) MapToString(f func(int) string) []string
- func (list IntList) Max() (result int)
- func (list IntList) MaxBy(less func(int, int) bool) int
- func (list IntList) Min() int
- func (list IntList) MinBy(less func(int, int) bool) int
- func (list IntList) MkString(sep string) string
- func (list IntList) MkString3(before, between, after string) string
- func (list IntList) NonEmpty() bool
- func (list IntList) Partition(p func(int) bool) (IntList, IntList)
- func (list IntList) Reverse() IntList
- func (list IntList) Send() <-chan int
- func (list IntList) Shuffle() IntList
- func (list IntList) Size() int
- func (list IntList) SortBy(less func(i, j int) bool) IntList
- func (list IntList) Sorted() IntList
- func (list IntList) StableSortBy(less func(i, j int) bool) IntList
- func (list IntList) StableSorted() IntList
- func (list IntList) String() string
- func (list IntList) StringList() []string
- func (list IntList) Sum() int
- func (list IntList) Swap(i, j int)
- func (list IntList) Tail() IntList
- func (list IntList) Take(n int) IntList
- func (list IntList) TakeLast(n int) IntList
- func (list IntList) TakeWhile(p func(int) bool) IntList
- func (list IntList) ToInterfaceSlice() []interface{}
- func (list IntList) ToList() IntList
- func (list IntList) ToSet() IntSet
- func (list IntList) ToSlice() []int
- type IntMkStringer
- type IntQueue
- func (queue *IntQueue) Add(more ...int)
- func (queue *IntQueue) Cap() int
- func (queue *IntQueue) Clear()
- func (queue *IntQueue) Clone() *IntQueue
- func (queue *IntQueue) Contains(v int) bool
- func (queue *IntQueue) ContainsAll(i ...int) bool
- func (queue *IntQueue) CountBy(p func(int) bool) (result int)
- func (queue *IntQueue) DoKeepWhere(p func(int) bool) *IntQueue
- func (queue *IntQueue) Equals(other *IntQueue) bool
- func (queue *IntQueue) Exists(p func(int) bool) bool
- func (queue *IntQueue) Filter(p func(int) bool) *IntQueue
- func (queue *IntQueue) Find(p func(int) bool) (int, bool)
- func (queue *IntQueue) FlatMap(f func(int) []int) *IntQueue
- func (queue *IntQueue) FlatMapToString(f func(int) []string) []string
- func (queue *IntQueue) Fold(initial int, fn func(int, int) int) int
- func (queue *IntQueue) Forall(p func(int) bool) bool
- func (queue *IntQueue) Foreach(f func(int))
- func (queue *IntQueue) Get(i int) int
- func (queue *IntQueue) Head() int
- func (queue *IntQueue) HeadOption() (int, bool)
- func (queue *IntQueue) IsEmpty() bool
- func (queue *IntQueue) IsFull() bool
- func (queue *IntQueue) IsOverwriting() bool
- func (queue *IntQueue) IsSequence() bool
- func (queue *IntQueue) IsSet() bool
- func (queue *IntQueue) Last() int
- func (queue *IntQueue) LastOption() (int, bool)
- func (queue *IntQueue) Len() int
- func (queue *IntQueue) Less(i, j int) bool
- func (queue *IntQueue) Map(f func(int) int) *IntQueue
- func (queue *IntQueue) MapToString(f func(int) string) []string
- func (queue IntQueue) MarshalJSON() ([]byte, error)
- func (queue *IntQueue) Max() (result int)
- func (queue *IntQueue) MaxBy(less func(int, int) bool) int
- func (queue *IntQueue) Min() int
- func (queue *IntQueue) MinBy(less func(int, int) bool) int
- func (queue *IntQueue) MkString(sep string) string
- func (queue *IntQueue) MkString3(before, between, after string) string
- func (queue *IntQueue) NonEmpty() bool
- func (queue *IntQueue) Offer(items ...int) []int
- func (queue *IntQueue) Partition(p func(int) bool) (*IntQueue, *IntQueue)
- func (queue *IntQueue) Pop(n int) []int
- func (queue *IntQueue) Pop1() (int, bool)
- func (queue *IntQueue) Push(items ...int) *IntQueue
- func (queue *IntQueue) Reallocate(capacity int, overwrite bool) *IntQueue
- func (queue *IntQueue) Send() <-chan int
- func (queue *IntQueue) Size() int
- func (queue *IntQueue) Sort()
- func (queue *IntQueue) Space() int
- func (queue *IntQueue) StableSort()
- func (queue *IntQueue) String() string
- func (queue *IntQueue) StringList() []string
- func (queue *IntQueue) Sum() int
- func (queue *IntQueue) Swap(i, j int)
- func (queue *IntQueue) ToInterfaceSlice() []interface{}
- func (queue *IntQueue) ToSlice() []int
- func (queue *IntQueue) UnmarshalJSON(b []byte) error
- type IntSequence
- type IntSet
- func (set IntSet) Add(more ...int) IntSet
- func (set IntSet) Append(more ...int) IntSet
- func (set IntSet) Cardinality() int
- func (set *IntSet) Clear()
- func (set IntSet) Clone() IntSet
- func (set IntSet) Contains(i int) bool
- func (set IntSet) ContainsAll(i ...int) bool
- func (set IntSet) CountBy(p func(int) bool) (result int)
- func (set IntSet) Difference(other IntSet) IntSet
- func (set IntSet) Equals(other IntSet) bool
- func (set IntSet) Exists(p func(int) bool) bool
- func (set IntSet) Filter(p func(int) bool) IntSet
- func (set IntSet) Find(p func(int) bool) (int, bool)
- func (set IntSet) FlatMap(f func(int) []int) IntSet
- func (set IntSet) FlatMapToString(f func(int) []string) []string
- func (set IntSet) Fold(initial int, fn func(int, int) int) int
- func (set IntSet) Forall(p func(int) bool) bool
- func (set IntSet) Foreach(f func(int))
- func (set IntSet) Intersect(other IntSet) IntSet
- func (set IntSet) IsEmpty() bool
- func (set IntSet) IsSequence() bool
- func (set IntSet) IsSet() bool
- func (set IntSet) IsSubset(other IntSet) bool
- func (set IntSet) IsSuperset(other IntSet) bool
- func (set IntSet) Map(f func(int) int) IntSet
- func (set IntSet) MapToString(f func(int) string) []string
- func (set IntSet) MarshalJSON() ([]byte, error)
- func (set IntSet) Max() int
- func (set IntSet) MaxBy(less func(int, int) bool) int
- func (set IntSet) Min() int
- func (set IntSet) MinBy(less func(int, int) bool) int
- func (set IntSet) MkString(sep string) string
- func (set IntSet) MkString3(before, between, after string) string
- func (set IntSet) NonEmpty() bool
- func (set IntSet) Partition(p func(int) bool) (IntSet, IntSet)
- func (set IntSet) Remove(i int)
- func (set IntSet) Send() <-chan int
- func (set IntSet) Size() int
- func (set IntSet) String() string
- func (set IntSet) StringList() []string
- func (set IntSet) StringMap() map[string]bool
- func (set IntSet) Sum() int
- func (set IntSet) SymmetricDifference(other IntSet) IntSet
- func (set IntSet) ToInterfaceSlice() []interface{}
- func (set IntSet) ToList() IntList
- func (set IntSet) ToSet() IntSet
- func (set IntSet) ToSlice() []int
- func (set IntSet) Union(other IntSet) IntSet
- func (set IntSet) UnmarshalJSON(b []byte) error
- type IntSizer
- type IntStringMap
- func (mm *IntStringMap) Clear()
- func (mm IntStringMap) Clone() IntStringMap
- func (mm IntStringMap) ContainsAllKeys(kk ...int) bool
- func (mm IntStringMap) ContainsKey(k int) bool
- func (mm IntStringMap) DropWhere(fn func(int, string) bool) IntStringTuples
- func (mm IntStringMap) Equals(other IntStringMap) bool
- func (mm IntStringMap) Exists(p func(int, string) bool) bool
- func (mm IntStringMap) Filter(p func(int, string) bool) IntStringMap
- func (mm IntStringMap) Find(p func(int, string) bool) (IntStringTuple, bool)
- func (mm IntStringMap) FlatMap(f func(int, string) []IntStringTuple) IntStringMap
- func (mm IntStringMap) Forall(p func(int, string) bool) bool
- func (mm IntStringMap) Foreach(f func(int, string))
- func (mm IntStringMap) Get(k int) (string, bool)
- func (mm IntStringMap) IsEmpty() bool
- func (mm IntStringMap) Keys() IntList
- func (mm IntStringMap) Map(f func(int, string) (int, string)) IntStringMap
- func (mm IntStringMap) MkString(sep string) string
- func (mm IntStringMap) MkString4(before, between, after, equals string) string
- func (mm IntStringMap) NonEmpty() bool
- func (mm IntStringMap) OrderedSlice(keys IntList) IntStringTuples
- func (mm IntStringMap) Partition(p func(int, string) bool) (matching IntStringMap, others IntStringMap)
- func (mm IntStringMap) Pop(k int) (string, bool)
- func (mm IntStringMap) Put(k int, v string) bool
- func (mm IntStringMap) Remove(k int)
- func (mm IntStringMap) Size() int
- func (mm IntStringMap) String() string
- func (mm IntStringMap) ToSlice() IntStringTuples
- func (mm IntStringMap) Values() StringList
- type IntStringTuple
- type IntStringTuples
- func (ts IntStringTuples) Append1(k int, v string) IntStringTuples
- func (ts IntStringTuples) Append2(k1 int, v1 string, k2 int, v2 string) IntStringTuples
- func (ts IntStringTuples) Append3(k1 int, v1 string, k2 int, v2 string, k3 int, v3 string) IntStringTuples
- func (ts IntStringTuples) MkString(sep string) string
- func (ts IntStringTuples) MkString4(before, between, after, equals string) string
- func (ts IntStringTuples) String() string
- func (ts IntStringTuples) ToMap() IntStringMap
- func (ts IntStringTuples) Values(values ...string) IntStringTuples
- type StringAnyMap
- func (mm *StringAnyMap) Clear()
- func (mm StringAnyMap) Clone() StringAnyMap
- func (mm StringAnyMap) ContainsAllKeys(kk ...string) bool
- func (mm StringAnyMap) ContainsKey(k string) bool
- func (mm StringAnyMap) DropWhere(fn func(string, interface{}) bool) StringAnyTuples
- func (mm StringAnyMap) Equals(other StringAnyMap) bool
- func (mm StringAnyMap) Exists(p func(string, interface{}) bool) bool
- func (mm StringAnyMap) Filter(p func(string, interface{}) bool) StringAnyMap
- func (mm StringAnyMap) Find(p func(string, interface{}) bool) (StringAnyTuple, bool)
- func (mm StringAnyMap) FlatMap(f func(string, interface{}) []StringAnyTuple) StringAnyMap
- func (mm StringAnyMap) Forall(p func(string, interface{}) bool) bool
- func (mm StringAnyMap) Foreach(f func(string, interface{}))
- func (mm StringAnyMap) Get(k string) (interface{}, bool)
- func (mm StringAnyMap) IsEmpty() bool
- func (mm StringAnyMap) Keys() StringList
- func (mm StringAnyMap) Map(f func(string, interface{}) (string, interface{})) StringAnyMap
- func (mm StringAnyMap) MkString(sep string) string
- func (mm StringAnyMap) MkString4(before, between, after, equals string) string
- func (mm StringAnyMap) NonEmpty() bool
- func (mm StringAnyMap) OrderedSlice(keys StringList) StringAnyTuples
- func (mm StringAnyMap) Partition(p func(string, interface{}) bool) (matching StringAnyMap, others StringAnyMap)
- func (mm StringAnyMap) Pop(k string) (interface{}, bool)
- func (mm StringAnyMap) Put(k string, v interface{}) bool
- func (mm StringAnyMap) Remove(k string)
- func (mm StringAnyMap) Size() int
- func (mm StringAnyMap) String() string
- func (mm StringAnyMap) ToSlice() StringAnyTuples
- func (mm StringAnyMap) Values() AnyList
- type StringAnyTuple
- type StringAnyTuples
- func (ts StringAnyTuples) Append1(k string, v interface{}) StringAnyTuples
- func (ts StringAnyTuples) Append2(k1 string, v1 interface{}, k2 string, v2 interface{}) StringAnyTuples
- func (ts StringAnyTuples) Append3(k1 string, v1 interface{}, k2 string, v2 interface{}, k3 string, ...) StringAnyTuples
- func (ts StringAnyTuples) MkString(sep string) string
- func (ts StringAnyTuples) MkString4(before, between, after, equals string) string
- func (ts StringAnyTuples) String() string
- func (ts StringAnyTuples) ToMap() StringAnyMap
- func (ts StringAnyTuples) Values(values ...interface{}) StringAnyTuples
- type StringCollection
- type StringIntMap
- func (mm *StringIntMap) Clear()
- func (mm StringIntMap) Clone() StringIntMap
- func (mm StringIntMap) ContainsAllKeys(kk ...string) bool
- func (mm StringIntMap) ContainsKey(k string) bool
- func (mm StringIntMap) DropWhere(fn func(string, int) bool) StringIntTuples
- func (mm StringIntMap) Equals(other StringIntMap) bool
- func (mm StringIntMap) Exists(p func(string, int) bool) bool
- func (mm StringIntMap) Filter(p func(string, int) bool) StringIntMap
- func (mm StringIntMap) Find(p func(string, int) bool) (StringIntTuple, bool)
- func (mm StringIntMap) FlatMap(f func(string, int) []StringIntTuple) StringIntMap
- func (mm StringIntMap) Forall(p func(string, int) bool) bool
- func (mm StringIntMap) Foreach(f func(string, int))
- func (mm StringIntMap) Get(k string) (int, bool)
- func (mm StringIntMap) IsEmpty() bool
- func (mm StringIntMap) Keys() StringList
- func (mm StringIntMap) Map(f func(string, int) (string, int)) StringIntMap
- func (mm StringIntMap) MkString(sep string) string
- func (mm StringIntMap) MkString4(before, between, after, equals string) string
- func (mm StringIntMap) NonEmpty() bool
- func (mm StringIntMap) OrderedSlice(keys StringList) StringIntTuples
- func (mm StringIntMap) Partition(p func(string, int) bool) (matching StringIntMap, others StringIntMap)
- func (mm StringIntMap) Pop(k string) (int, bool)
- func (mm StringIntMap) Put(k string, v int) bool
- func (mm StringIntMap) Remove(k string)
- func (mm StringIntMap) Size() int
- func (mm StringIntMap) String() string
- func (mm StringIntMap) ToSlice() StringIntTuples
- func (mm StringIntMap) Values() IntList
- type StringIntTuple
- type StringIntTuples
- func (ts StringIntTuples) Append1(k string, v int) StringIntTuples
- func (ts StringIntTuples) Append2(k1 string, v1 int, k2 string, v2 int) StringIntTuples
- func (ts StringIntTuples) Append3(k1 string, v1 int, k2 string, v2 int, k3 string, v3 int) StringIntTuples
- func (ts StringIntTuples) MkString(sep string) string
- func (ts StringIntTuples) MkString4(before, between, after, equals string) string
- func (ts StringIntTuples) String() string
- func (ts StringIntTuples) ToMap() StringIntMap
- func (ts StringIntTuples) Values(values ...int) StringIntTuples
- type StringList
- func (list StringList) Clone() StringList
- func (list StringList) Contains(v string) bool
- func (list StringList) ContainsAll(i ...string) bool
- func (list StringList) CountBy(p func(string) bool) (result int)
- func (list StringList) DistinctBy(equal func(string, string) bool) StringList
- func (list StringList) DoReverse() StringList
- func (list StringList) DoShuffle() StringList
- func (list StringList) Drop(n int) StringList
- func (list StringList) DropLast(n int) StringList
- func (list StringList) DropWhile(p func(string) bool) StringList
- func (list StringList) Equals(other StringList) bool
- func (list StringList) Exists(p func(string) bool) bool
- func (list StringList) Filter(p func(string) bool) StringList
- func (list StringList) Find(p func(string) bool) (string, bool)
- func (list StringList) FlatMap(f func(string) []string) StringList
- func (list StringList) FlatMapToInt(f func(string) []int) []int
- func (list StringList) Fold(initial string, fn func(string, string) string) string
- func (list StringList) Forall(p func(string) bool) bool
- func (list StringList) Foreach(f func(string))
- func (list StringList) Get(i int) string
- func (list StringList) GobDecode(b []byte) error
- func (list StringList) GobEncode() ([]byte, error)
- func (list StringList) Head() string
- func (list StringList) HeadOption() (string, bool)
- func (list StringList) IndexWhere(p func(string) bool) int
- func (list StringList) IndexWhere2(p func(string) bool, from int) int
- func (list StringList) Init() StringList
- func (list StringList) IsEmpty() bool
- func (list StringList) IsSequence() bool
- func (list StringList) IsSet() bool
- func (list StringList) Last() string
- func (list StringList) LastIndexWhere(p func(string) bool) int
- func (list StringList) LastIndexWhere2(p func(string) bool, before int) int
- func (list StringList) LastOption() (string, bool)
- func (list StringList) Len() int
- func (list StringList) Map(f func(string) string) StringList
- func (list StringList) MapToInt(f func(string) int) []int
- func (list StringList) MaxBy(less func(string, string) bool) string
- func (list StringList) MinBy(less func(string, string) bool) string
- func (list StringList) MkString(sep string) string
- func (list StringList) MkString3(before, between, after string) string
- func (list StringList) NonEmpty() bool
- func (list StringList) Partition(p func(string) bool) (StringList, StringList)
- func (list StringList) Reverse() StringList
- func (list StringList) Send() <-chan string
- func (list StringList) Shuffle() StringList
- func (list StringList) Size() int
- func (list StringList) SortBy(less func(i, j string) bool) StringList
- func (list StringList) Sorted() StringList
- func (list StringList) StableSortBy(less func(i, j string) bool) StringList
- func (list StringList) String() string
- func (list StringList) StringList() []string
- func (list StringList) Swap(i, j int)
- func (list StringList) Tail() StringList
- func (list StringList) Take(n int) StringList
- func (list StringList) TakeLast(n int) StringList
- func (list StringList) TakeWhile(p func(string) bool) StringList
- func (list StringList) ToInterfaceSlice() []interface{}
- func (list StringList) ToList() StringList
- func (list StringList) ToSet() StringSet
- func (list StringList) ToSlice() []string
- type StringMkStringer
- type StringQueue
- func (queue *StringQueue) Add(more ...string)
- func (queue *StringQueue) Cap() int
- func (queue *StringQueue) Clear()
- func (queue *StringQueue) Clone() *StringQueue
- func (queue *StringQueue) Contains(v string) bool
- func (queue *StringQueue) ContainsAll(i ...string) bool
- func (queue *StringQueue) CountBy(p func(string) bool) (result int)
- func (queue *StringQueue) DoKeepWhere(p func(string) bool) *StringQueue
- func (queue *StringQueue) Equals(other *StringQueue) bool
- func (queue *StringQueue) Exists(p func(string) bool) bool
- func (queue *StringQueue) Filter(p func(string) bool) *StringQueue
- func (queue *StringQueue) Find(p func(string) bool) (string, bool)
- func (queue *StringQueue) FlatMap(f func(string) []string) *StringQueue
- func (queue *StringQueue) FlatMapToInt(f func(string) []int) []int
- func (queue *StringQueue) Fold(initial string, fn func(string, string) string) string
- func (queue *StringQueue) Forall(p func(string) bool) bool
- func (queue *StringQueue) Foreach(f func(string))
- func (queue *StringQueue) Get(i int) string
- func (queue *StringQueue) Head() string
- func (queue *StringQueue) HeadOption() (string, bool)
- func (queue *StringQueue) IsEmpty() bool
- func (queue *StringQueue) IsFull() bool
- func (queue *StringQueue) IsOverwriting() bool
- func (queue *StringQueue) IsSequence() bool
- func (queue *StringQueue) IsSet() bool
- func (queue *StringQueue) Last() string
- func (queue *StringQueue) LastOption() (string, bool)
- func (queue *StringQueue) Len() int
- func (queue *StringQueue) Less(i, j int) bool
- func (queue *StringQueue) Map(f func(string) string) *StringQueue
- func (queue *StringQueue) MapToInt(f func(string) int) []int
- func (queue StringQueue) MarshalJSON() ([]byte, error)
- func (queue *StringQueue) MaxBy(less func(string, string) bool) string
- func (queue *StringQueue) MinBy(less func(string, string) bool) string
- func (queue *StringQueue) MkString(sep string) string
- func (queue *StringQueue) MkString3(before, between, after string) string
- func (queue *StringQueue) NonEmpty() bool
- func (queue *StringQueue) Offer(items ...string) []string
- func (queue *StringQueue) Partition(p func(string) bool) (*StringQueue, *StringQueue)
- func (queue *StringQueue) Pop(n int) []string
- func (queue *StringQueue) Pop1() (string, bool)
- func (queue *StringQueue) Push(items ...string) *StringQueue
- func (queue *StringQueue) Reallocate(capacity int, overwrite bool) *StringQueue
- func (queue *StringQueue) Send() <-chan string
- func (queue *StringQueue) Size() int
- func (queue *StringQueue) Sort()
- func (queue *StringQueue) Space() int
- func (queue *StringQueue) StableSort()
- func (queue *StringQueue) String() string
- func (queue *StringQueue) StringList() []string
- func (queue *StringQueue) Swap(i, j int)
- func (queue *StringQueue) ToInterfaceSlice() []interface{}
- func (queue *StringQueue) ToSlice() []string
- func (queue *StringQueue) UnmarshalJSON(b []byte) error
- type StringSequence
- type StringSet
- func (set StringSet) Add(more ...string) StringSet
- func (set StringSet) Append(more ...string) StringSet
- func (set StringSet) Cardinality() int
- func (set *StringSet) Clear()
- func (set StringSet) Clone() StringSet
- func (set StringSet) Contains(i string) bool
- func (set StringSet) ContainsAll(i ...string) bool
- func (set StringSet) CountBy(p func(string) bool) (result int)
- func (set StringSet) Difference(other StringSet) StringSet
- func (set StringSet) Equals(other StringSet) bool
- func (set StringSet) Exists(p func(string) bool) bool
- func (set StringSet) Filter(p func(string) bool) StringSet
- func (set StringSet) Find(p func(string) bool) (string, bool)
- func (set StringSet) FlatMap(f func(string) []string) StringSet
- func (set StringSet) FlatMapToInt(f func(string) []int) []int
- func (set StringSet) Fold(initial string, fn func(string, string) string) string
- func (set StringSet) Forall(p func(string) bool) bool
- func (set StringSet) Foreach(f func(string))
- func (set StringSet) Intersect(other StringSet) StringSet
- func (set StringSet) IsEmpty() bool
- func (set StringSet) IsSequence() bool
- func (set StringSet) IsSet() bool
- func (set StringSet) IsSubset(other StringSet) bool
- func (set StringSet) IsSuperset(other StringSet) bool
- func (set StringSet) Map(f func(string) string) StringSet
- func (set StringSet) MapToInt(f func(string) int) []int
- func (set StringSet) MarshalJSON() ([]byte, error)
- func (set StringSet) MaxBy(less func(string, string) bool) string
- func (set StringSet) MinBy(less func(string, string) bool) string
- func (set StringSet) MkString(sep string) string
- func (set StringSet) MkString3(before, between, after string) string
- func (set StringSet) NonEmpty() bool
- func (set StringSet) Partition(p func(string) bool) (StringSet, StringSet)
- func (set StringSet) Remove(i string)
- func (set StringSet) Send() <-chan string
- func (set StringSet) Size() int
- func (set StringSet) String() string
- func (set StringSet) StringList() []string
- func (set StringSet) StringMap() map[string]bool
- func (set StringSet) SymmetricDifference(other StringSet) StringSet
- func (set StringSet) ToInterfaceSlice() []interface{}
- func (set StringSet) ToList() StringList
- func (set StringSet) ToSet() StringSet
- func (set StringSet) ToSlice() []string
- func (set StringSet) Union(other StringSet) StringSet
- func (set StringSet) UnmarshalJSON(b []byte) error
- type StringSizer
- type StringStringMap
- func (mm *StringStringMap) Clear()
- func (mm StringStringMap) Clone() StringStringMap
- func (mm StringStringMap) ContainsAllKeys(kk ...string) bool
- func (mm StringStringMap) ContainsKey(k string) bool
- func (mm StringStringMap) DropWhere(fn func(string, string) bool) StringStringTuples
- func (mm StringStringMap) Equals(other StringStringMap) bool
- func (mm StringStringMap) Exists(p func(string, string) bool) bool
- func (mm StringStringMap) Filter(p func(string, string) bool) StringStringMap
- func (mm StringStringMap) Find(p func(string, string) bool) (StringStringTuple, bool)
- func (mm StringStringMap) FlatMap(f func(string, string) []StringStringTuple) StringStringMap
- func (mm StringStringMap) Forall(p func(string, string) bool) bool
- func (mm StringStringMap) Foreach(f func(string, string))
- func (mm StringStringMap) Get(k string) (string, bool)
- func (mm StringStringMap) IsEmpty() bool
- func (mm StringStringMap) Keys() StringList
- func (mm StringStringMap) Map(f func(string, string) (string, string)) StringStringMap
- func (mm StringStringMap) MkString(sep string) string
- func (mm StringStringMap) MkString4(before, between, after, equals string) string
- func (mm StringStringMap) NonEmpty() bool
- func (mm StringStringMap) OrderedSlice(keys StringList) StringStringTuples
- func (mm StringStringMap) Partition(p func(string, string) bool) (matching StringStringMap, others StringStringMap)
- func (mm StringStringMap) Pop(k string) (string, bool)
- func (mm StringStringMap) Put(k string, v string) bool
- func (mm StringStringMap) Remove(k string)
- func (mm StringStringMap) Size() int
- func (mm StringStringMap) String() string
- func (mm StringStringMap) ToSlice() StringStringTuples
- func (mm StringStringMap) Values() StringList
- type StringStringTuple
- type StringStringTuples
- func (ts StringStringTuples) Append1(k string, v string) StringStringTuples
- func (ts StringStringTuples) Append2(k1 string, v1 string, k2 string, v2 string) StringStringTuples
- func (ts StringStringTuples) Append3(k1 string, v1 string, k2 string, v2 string, k3 string, v3 string) StringStringTuples
- func (ts StringStringTuples) MkString(sep string) string
- func (ts StringStringTuples) MkString4(before, between, after, equals string) string
- func (ts StringStringTuples) String() string
- func (ts StringStringTuples) ToMap() StringStringMap
- func (ts StringStringTuples) Values(values ...string) StringStringTuples
- type StringUintMap
- func (mm *StringUintMap) Clear()
- func (mm StringUintMap) Clone() StringUintMap
- func (mm StringUintMap) ContainsAllKeys(kk ...string) bool
- func (mm StringUintMap) ContainsKey(k string) bool
- func (mm StringUintMap) DropWhere(fn func(string, uint) bool) StringUintTuples
- func (mm StringUintMap) Equals(other StringUintMap) bool
- func (mm StringUintMap) Exists(p func(string, uint) bool) bool
- func (mm StringUintMap) Filter(p func(string, uint) bool) StringUintMap
- func (mm StringUintMap) Find(p func(string, uint) bool) (StringUintTuple, bool)
- func (mm StringUintMap) FlatMap(f func(string, uint) []StringUintTuple) StringUintMap
- func (mm StringUintMap) Forall(p func(string, uint) bool) bool
- func (mm StringUintMap) Foreach(f func(string, uint))
- func (mm StringUintMap) Get(k string) (uint, bool)
- func (mm StringUintMap) IsEmpty() bool
- func (mm StringUintMap) Keys() StringList
- func (mm StringUintMap) Map(f func(string, uint) (string, uint)) StringUintMap
- func (mm StringUintMap) MkString(sep string) string
- func (mm StringUintMap) MkString4(before, between, after, equals string) string
- func (mm StringUintMap) NonEmpty() bool
- func (mm StringUintMap) OrderedSlice(keys StringList) StringUintTuples
- func (mm StringUintMap) Partition(p func(string, uint) bool) (matching StringUintMap, others StringUintMap)
- func (mm StringUintMap) Pop(k string) (uint, bool)
- func (mm StringUintMap) Put(k string, v uint) bool
- func (mm StringUintMap) Remove(k string)
- func (mm StringUintMap) Size() int
- func (mm StringUintMap) String() string
- func (mm StringUintMap) ToSlice() StringUintTuples
- func (mm StringUintMap) Values() UintList
- type StringUintTuple
- type StringUintTuples
- func (ts StringUintTuples) Append1(k string, v uint) StringUintTuples
- func (ts StringUintTuples) Append2(k1 string, v1 uint, k2 string, v2 uint) StringUintTuples
- func (ts StringUintTuples) Append3(k1 string, v1 uint, k2 string, v2 uint, k3 string, v3 uint) StringUintTuples
- func (ts StringUintTuples) MkString(sep string) string
- func (ts StringUintTuples) MkString4(before, between, after, equals string) string
- func (ts StringUintTuples) String() string
- func (ts StringUintTuples) ToMap() StringUintMap
- func (ts StringUintTuples) Values(values ...uint) StringUintTuples
- type Uint64Collection
- type Uint64List
- func (list Uint64List) Clone() Uint64List
- func (list Uint64List) Contains(v uint64) bool
- func (list Uint64List) ContainsAll(i ...uint64) bool
- func (list Uint64List) CountBy(p func(uint64) bool) (result int)
- func (list Uint64List) DistinctBy(equal func(uint64, uint64) bool) Uint64List
- func (list Uint64List) DoReverse() Uint64List
- func (list Uint64List) DoShuffle() Uint64List
- func (list Uint64List) Drop(n int) Uint64List
- func (list Uint64List) DropLast(n int) Uint64List
- func (list Uint64List) DropWhile(p func(uint64) bool) Uint64List
- func (list Uint64List) Equals(other Uint64List) bool
- func (list Uint64List) Exists(p func(uint64) bool) bool
- func (list Uint64List) Filter(p func(uint64) bool) Uint64List
- func (list Uint64List) Find(p func(uint64) bool) (uint64, bool)
- func (list Uint64List) FlatMap(f func(uint64) []uint64) Uint64List
- func (list Uint64List) FlatMapToString(f func(uint64) []string) []string
- func (list Uint64List) Fold(initial uint64, fn func(uint64, uint64) uint64) uint64
- func (list Uint64List) Forall(p func(uint64) bool) bool
- func (list Uint64List) Foreach(f func(uint64))
- func (list Uint64List) Get(i int) uint64
- func (list Uint64List) GobDecode(b []byte) error
- func (list Uint64List) GobEncode() ([]byte, error)
- func (list Uint64List) Head() uint64
- func (list Uint64List) HeadOption() (uint64, bool)
- func (list Uint64List) IndexWhere(p func(uint64) bool) int
- func (list Uint64List) IndexWhere2(p func(uint64) bool, from int) int
- func (list Uint64List) Init() Uint64List
- func (list Uint64List) IsEmpty() bool
- func (list Uint64List) IsSequence() bool
- func (list Uint64List) IsSet() bool
- func (list Uint64List) Last() uint64
- func (list Uint64List) LastIndexWhere(p func(uint64) bool) int
- func (list Uint64List) LastIndexWhere2(p func(uint64) bool, before int) int
- func (list Uint64List) LastOption() (uint64, bool)
- func (list Uint64List) Len() int
- func (list Uint64List) Map(f func(uint64) uint64) Uint64List
- func (list Uint64List) MapToString(f func(uint64) string) []string
- func (list Uint64List) Max() (result uint64)
- func (list Uint64List) MaxBy(less func(uint64, uint64) bool) uint64
- func (list Uint64List) Min() uint64
- func (list Uint64List) MinBy(less func(uint64, uint64) bool) uint64
- func (list Uint64List) MkString(sep string) string
- func (list Uint64List) MkString3(before, between, after string) string
- func (list Uint64List) NonEmpty() bool
- func (list Uint64List) Partition(p func(uint64) bool) (Uint64List, Uint64List)
- func (list Uint64List) Reverse() Uint64List
- func (list Uint64List) Send() <-chan uint64
- func (list Uint64List) Shuffle() Uint64List
- func (list Uint64List) Size() int
- func (list Uint64List) SortBy(less func(i, j uint64) bool) Uint64List
- func (list Uint64List) Sorted() Uint64List
- func (list Uint64List) StableSortBy(less func(i, j uint64) bool) Uint64List
- func (list Uint64List) StableSorted() Uint64List
- func (list Uint64List) String() string
- func (list Uint64List) StringList() []string
- func (list Uint64List) Sum() uint64
- func (list Uint64List) Swap(i, j int)
- func (list Uint64List) Tail() Uint64List
- func (list Uint64List) Take(n int) Uint64List
- func (list Uint64List) TakeLast(n int) Uint64List
- func (list Uint64List) TakeWhile(p func(uint64) bool) Uint64List
- func (list Uint64List) ToInterfaceSlice() []interface{}
- func (list Uint64List) ToList() Uint64List
- func (list Uint64List) ToSet() Uint64Set
- func (list Uint64List) ToSlice() []uint64
- type Uint64MkStringer
- type Uint64Queue
- func (queue *Uint64Queue) Add(more ...uint64)
- func (queue *Uint64Queue) Cap() int
- func (queue *Uint64Queue) Clear()
- func (queue *Uint64Queue) Clone() *Uint64Queue
- func (queue *Uint64Queue) Contains(v uint64) bool
- func (queue *Uint64Queue) ContainsAll(i ...uint64) bool
- func (queue *Uint64Queue) CountBy(p func(uint64) bool) (result int)
- func (queue *Uint64Queue) DoKeepWhere(p func(uint64) bool) *Uint64Queue
- func (queue *Uint64Queue) Equals(other *Uint64Queue) bool
- func (queue *Uint64Queue) Exists(p func(uint64) bool) bool
- func (queue *Uint64Queue) Filter(p func(uint64) bool) *Uint64Queue
- func (queue *Uint64Queue) Find(p func(uint64) bool) (uint64, bool)
- func (queue *Uint64Queue) FlatMap(f func(uint64) []uint64) *Uint64Queue
- func (queue *Uint64Queue) FlatMapToString(f func(uint64) []string) []string
- func (queue *Uint64Queue) Fold(initial uint64, fn func(uint64, uint64) uint64) uint64
- func (queue *Uint64Queue) Forall(p func(uint64) bool) bool
- func (queue *Uint64Queue) Foreach(f func(uint64))
- func (queue *Uint64Queue) Get(i int) uint64
- func (queue *Uint64Queue) Head() uint64
- func (queue *Uint64Queue) HeadOption() (uint64, bool)
- func (queue *Uint64Queue) IsEmpty() bool
- func (queue *Uint64Queue) IsFull() bool
- func (queue *Uint64Queue) IsOverwriting() bool
- func (queue *Uint64Queue) IsSequence() bool
- func (queue *Uint64Queue) IsSet() bool
- func (queue *Uint64Queue) Last() uint64
- func (queue *Uint64Queue) LastOption() (uint64, bool)
- func (queue *Uint64Queue) Len() int
- func (queue *Uint64Queue) Less(i, j int) bool
- func (queue *Uint64Queue) Map(f func(uint64) uint64) *Uint64Queue
- func (queue *Uint64Queue) MapToString(f func(uint64) string) []string
- func (queue Uint64Queue) MarshalJSON() ([]byte, error)
- func (queue *Uint64Queue) Max() (result uint64)
- func (queue *Uint64Queue) MaxBy(less func(uint64, uint64) bool) uint64
- func (queue *Uint64Queue) Min() uint64
- func (queue *Uint64Queue) MinBy(less func(uint64, uint64) bool) uint64
- func (queue *Uint64Queue) MkString(sep string) string
- func (queue *Uint64Queue) MkString3(before, between, after string) string
- func (queue *Uint64Queue) NonEmpty() bool
- func (queue *Uint64Queue) Offer(items ...uint64) []uint64
- func (queue *Uint64Queue) Partition(p func(uint64) bool) (*Uint64Queue, *Uint64Queue)
- func (queue *Uint64Queue) Pop(n int) []uint64
- func (queue *Uint64Queue) Pop1() (uint64, bool)
- func (queue *Uint64Queue) Push(items ...uint64) *Uint64Queue
- func (queue *Uint64Queue) Reallocate(capacity int, overwrite bool) *Uint64Queue
- func (queue *Uint64Queue) Send() <-chan uint64
- func (queue *Uint64Queue) Size() int
- func (queue *Uint64Queue) Sort()
- func (queue *Uint64Queue) Space() int
- func (queue *Uint64Queue) StableSort()
- func (queue *Uint64Queue) String() string
- func (queue *Uint64Queue) StringList() []string
- func (queue *Uint64Queue) Sum() uint64
- func (queue *Uint64Queue) Swap(i, j int)
- func (queue *Uint64Queue) ToInterfaceSlice() []interface{}
- func (queue *Uint64Queue) ToSlice() []uint64
- func (queue *Uint64Queue) UnmarshalJSON(b []byte) error
- type Uint64Sequence
- type Uint64Set
- func (set Uint64Set) Add(more ...uint64) Uint64Set
- func (set Uint64Set) Append(more ...uint64) Uint64Set
- func (set Uint64Set) Cardinality() int
- func (set *Uint64Set) Clear()
- func (set Uint64Set) Clone() Uint64Set
- func (set Uint64Set) Contains(i uint64) bool
- func (set Uint64Set) ContainsAll(i ...uint64) bool
- func (set Uint64Set) CountBy(p func(uint64) bool) (result int)
- func (set Uint64Set) Difference(other Uint64Set) Uint64Set
- func (set Uint64Set) Equals(other Uint64Set) bool
- func (set Uint64Set) Exists(p func(uint64) bool) bool
- func (set Uint64Set) Filter(p func(uint64) bool) Uint64Set
- func (set Uint64Set) Find(p func(uint64) bool) (uint64, bool)
- func (set Uint64Set) FlatMap(f func(uint64) []uint64) Uint64Set
- func (set Uint64Set) FlatMapToString(f func(uint64) []string) []string
- func (set Uint64Set) Fold(initial uint64, fn func(uint64, uint64) uint64) uint64
- func (set Uint64Set) Forall(p func(uint64) bool) bool
- func (set Uint64Set) Foreach(f func(uint64))
- func (set Uint64Set) Intersect(other Uint64Set) Uint64Set
- func (set Uint64Set) IsEmpty() bool
- func (set Uint64Set) IsSequence() bool
- func (set Uint64Set) IsSet() bool
- func (set Uint64Set) IsSubset(other Uint64Set) bool
- func (set Uint64Set) IsSuperset(other Uint64Set) bool
- func (set Uint64Set) Map(f func(uint64) uint64) Uint64Set
- func (set Uint64Set) MapToString(f func(uint64) string) []string
- func (set Uint64Set) MarshalJSON() ([]byte, error)
- func (set Uint64Set) Max() uint64
- func (set Uint64Set) MaxBy(less func(uint64, uint64) bool) uint64
- func (set Uint64Set) Min() uint64
- func (set Uint64Set) MinBy(less func(uint64, uint64) bool) uint64
- func (set Uint64Set) MkString(sep string) string
- func (set Uint64Set) MkString3(before, between, after string) string
- func (set Uint64Set) NonEmpty() bool
- func (set Uint64Set) Partition(p func(uint64) bool) (Uint64Set, Uint64Set)
- func (set Uint64Set) Remove(i uint64)
- func (set Uint64Set) Send() <-chan uint64
- func (set Uint64Set) Size() int
- func (set Uint64Set) String() string
- func (set Uint64Set) StringList() []string
- func (set Uint64Set) StringMap() map[string]bool
- func (set Uint64Set) Sum() uint64
- func (set Uint64Set) SymmetricDifference(other Uint64Set) Uint64Set
- func (set Uint64Set) ToInterfaceSlice() []interface{}
- func (set Uint64Set) ToList() Uint64List
- func (set Uint64Set) ToSet() Uint64Set
- func (set Uint64Set) ToSlice() []uint64
- func (set Uint64Set) Union(other Uint64Set) Uint64Set
- func (set Uint64Set) UnmarshalJSON(b []byte) error
- type Uint64Sizer
- type Uint64StringMap
- func (mm *Uint64StringMap) Clear()
- func (mm Uint64StringMap) Clone() Uint64StringMap
- func (mm Uint64StringMap) ContainsAllKeys(kk ...uint64) bool
- func (mm Uint64StringMap) ContainsKey(k uint64) bool
- func (mm Uint64StringMap) DropWhere(fn func(uint64, string) bool) Uint64StringTuples
- func (mm Uint64StringMap) Equals(other Uint64StringMap) bool
- func (mm Uint64StringMap) Exists(p func(uint64, string) bool) bool
- func (mm Uint64StringMap) Filter(p func(uint64, string) bool) Uint64StringMap
- func (mm Uint64StringMap) Find(p func(uint64, string) bool) (Uint64StringTuple, bool)
- func (mm Uint64StringMap) FlatMap(f func(uint64, string) []Uint64StringTuple) Uint64StringMap
- func (mm Uint64StringMap) Forall(p func(uint64, string) bool) bool
- func (mm Uint64StringMap) Foreach(f func(uint64, string))
- func (mm Uint64StringMap) Get(k uint64) (string, bool)
- func (mm Uint64StringMap) IsEmpty() bool
- func (mm Uint64StringMap) Keys() Uint64List
- func (mm Uint64StringMap) Map(f func(uint64, string) (uint64, string)) Uint64StringMap
- func (mm Uint64StringMap) MkString(sep string) string
- func (mm Uint64StringMap) MkString4(before, between, after, equals string) string
- func (mm Uint64StringMap) NonEmpty() bool
- func (mm Uint64StringMap) OrderedSlice(keys Uint64List) Uint64StringTuples
- func (mm Uint64StringMap) Partition(p func(uint64, string) bool) (matching Uint64StringMap, others Uint64StringMap)
- func (mm Uint64StringMap) Pop(k uint64) (string, bool)
- func (mm Uint64StringMap) Put(k uint64, v string) bool
- func (mm Uint64StringMap) Remove(k uint64)
- func (mm Uint64StringMap) Size() int
- func (mm Uint64StringMap) String() string
- func (mm Uint64StringMap) ToSlice() Uint64StringTuples
- func (mm Uint64StringMap) Values() StringList
- type Uint64StringTuple
- type Uint64StringTuples
- func (ts Uint64StringTuples) Append1(k uint64, v string) Uint64StringTuples
- func (ts Uint64StringTuples) Append2(k1 uint64, v1 string, k2 uint64, v2 string) Uint64StringTuples
- func (ts Uint64StringTuples) Append3(k1 uint64, v1 string, k2 uint64, v2 string, k3 uint64, v3 string) Uint64StringTuples
- func (ts Uint64StringTuples) MkString(sep string) string
- func (ts Uint64StringTuples) MkString4(before, between, after, equals string) string
- func (ts Uint64StringTuples) String() string
- func (ts Uint64StringTuples) ToMap() Uint64StringMap
- func (ts Uint64StringTuples) Values(values ...string) Uint64StringTuples
- type Uint64Uint64Map
- func (mm *Uint64Uint64Map) Clear()
- func (mm Uint64Uint64Map) Clone() Uint64Uint64Map
- func (mm Uint64Uint64Map) ContainsAllKeys(kk ...uint64) bool
- func (mm Uint64Uint64Map) ContainsKey(k uint64) bool
- func (mm Uint64Uint64Map) DropWhere(fn func(uint64, uint64) bool) Uint64Uint64Tuples
- func (mm Uint64Uint64Map) Equals(other Uint64Uint64Map) bool
- func (mm Uint64Uint64Map) Exists(p func(uint64, uint64) bool) bool
- func (mm Uint64Uint64Map) Filter(p func(uint64, uint64) bool) Uint64Uint64Map
- func (mm Uint64Uint64Map) Find(p func(uint64, uint64) bool) (Uint64Uint64Tuple, bool)
- func (mm Uint64Uint64Map) FlatMap(f func(uint64, uint64) []Uint64Uint64Tuple) Uint64Uint64Map
- func (mm Uint64Uint64Map) Forall(p func(uint64, uint64) bool) bool
- func (mm Uint64Uint64Map) Foreach(f func(uint64, uint64))
- func (mm Uint64Uint64Map) Get(k uint64) (uint64, bool)
- func (mm Uint64Uint64Map) IsEmpty() bool
- func (mm Uint64Uint64Map) Keys() Uint64List
- func (mm Uint64Uint64Map) Map(f func(uint64, uint64) (uint64, uint64)) Uint64Uint64Map
- func (mm Uint64Uint64Map) MkString(sep string) string
- func (mm Uint64Uint64Map) MkString4(before, between, after, equals string) string
- func (mm Uint64Uint64Map) NonEmpty() bool
- func (mm Uint64Uint64Map) OrderedSlice(keys Uint64List) Uint64Uint64Tuples
- func (mm Uint64Uint64Map) Partition(p func(uint64, uint64) bool) (matching Uint64Uint64Map, others Uint64Uint64Map)
- func (mm Uint64Uint64Map) Pop(k uint64) (uint64, bool)
- func (mm Uint64Uint64Map) Put(k uint64, v uint64) bool
- func (mm Uint64Uint64Map) Remove(k uint64)
- func (mm Uint64Uint64Map) Size() int
- func (mm Uint64Uint64Map) String() string
- func (mm Uint64Uint64Map) ToSlice() Uint64Uint64Tuples
- func (mm Uint64Uint64Map) Values() Uint64List
- type Uint64Uint64Tuple
- type Uint64Uint64Tuples
- func (ts Uint64Uint64Tuples) Append1(k uint64, v uint64) Uint64Uint64Tuples
- func (ts Uint64Uint64Tuples) Append2(k1 uint64, v1 uint64, k2 uint64, v2 uint64) Uint64Uint64Tuples
- func (ts Uint64Uint64Tuples) Append3(k1 uint64, v1 uint64, k2 uint64, v2 uint64, k3 uint64, v3 uint64) Uint64Uint64Tuples
- func (ts Uint64Uint64Tuples) MkString(sep string) string
- func (ts Uint64Uint64Tuples) MkString4(before, between, after, equals string) string
- func (ts Uint64Uint64Tuples) String() string
- func (ts Uint64Uint64Tuples) ToMap() Uint64Uint64Map
- func (ts Uint64Uint64Tuples) Values(values ...uint64) Uint64Uint64Tuples
- type UintCollection
- type UintList
- func (list UintList) Clone() UintList
- func (list UintList) Contains(v uint) bool
- func (list UintList) ContainsAll(i ...uint) bool
- func (list UintList) CountBy(p func(uint) bool) (result int)
- func (list UintList) DistinctBy(equal func(uint, uint) bool) UintList
- func (list UintList) DoReverse() UintList
- func (list UintList) DoShuffle() UintList
- func (list UintList) Drop(n int) UintList
- func (list UintList) DropLast(n int) UintList
- func (list UintList) DropWhile(p func(uint) bool) UintList
- func (list UintList) Equals(other UintList) bool
- func (list UintList) Exists(p func(uint) bool) bool
- func (list UintList) Filter(p func(uint) bool) UintList
- func (list UintList) Find(p func(uint) bool) (uint, bool)
- func (list UintList) FlatMap(f func(uint) []uint) UintList
- func (list UintList) FlatMapToString(f func(uint) []string) []string
- func (list UintList) Fold(initial uint, fn func(uint, uint) uint) uint
- func (list UintList) Forall(p func(uint) bool) bool
- func (list UintList) Foreach(f func(uint))
- func (list UintList) Get(i int) uint
- func (list UintList) GobDecode(b []byte) error
- func (list UintList) GobEncode() ([]byte, error)
- func (list UintList) Head() uint
- func (list UintList) HeadOption() (uint, bool)
- func (list UintList) IndexWhere(p func(uint) bool) int
- func (list UintList) IndexWhere2(p func(uint) bool, from int) int
- func (list UintList) Init() UintList
- func (list UintList) IsEmpty() bool
- func (list UintList) IsSequence() bool
- func (list UintList) IsSet() bool
- func (list UintList) Last() uint
- func (list UintList) LastIndexWhere(p func(uint) bool) int
- func (list UintList) LastIndexWhere2(p func(uint) bool, before int) int
- func (list UintList) LastOption() (uint, bool)
- func (list UintList) Len() int
- func (list UintList) Map(f func(uint) uint) UintList
- func (list UintList) MapToString(f func(uint) string) []string
- func (list UintList) Max() (result uint)
- func (list UintList) MaxBy(less func(uint, uint) bool) uint
- func (list UintList) Min() uint
- func (list UintList) MinBy(less func(uint, uint) bool) uint
- func (list UintList) MkString(sep string) string
- func (list UintList) MkString3(before, between, after string) string
- func (list UintList) NonEmpty() bool
- func (list UintList) Partition(p func(uint) bool) (UintList, UintList)
- func (list UintList) Reverse() UintList
- func (list UintList) Send() <-chan uint
- func (list UintList) Shuffle() UintList
- func (list UintList) Size() int
- func (list UintList) SortBy(less func(i, j uint) bool) UintList
- func (list UintList) Sorted() UintList
- func (list UintList) StableSortBy(less func(i, j uint) bool) UintList
- func (list UintList) StableSorted() UintList
- func (list UintList) String() string
- func (list UintList) StringList() []string
- func (list UintList) Sum() uint
- func (list UintList) Swap(i, j int)
- func (list UintList) Tail() UintList
- func (list UintList) Take(n int) UintList
- func (list UintList) TakeLast(n int) UintList
- func (list UintList) TakeWhile(p func(uint) bool) UintList
- func (list UintList) ToInterfaceSlice() []interface{}
- func (list UintList) ToList() UintList
- func (list UintList) ToSet() UintSet
- func (list UintList) ToSlice() []uint
- type UintMkStringer
- type UintQueue
- func (queue *UintQueue) Add(more ...uint)
- func (queue *UintQueue) Cap() int
- func (queue *UintQueue) Clear()
- func (queue *UintQueue) Clone() *UintQueue
- func (queue *UintQueue) Contains(v uint) bool
- func (queue *UintQueue) ContainsAll(i ...uint) bool
- func (queue *UintQueue) CountBy(p func(uint) bool) (result int)
- func (queue *UintQueue) DoKeepWhere(p func(uint) bool) *UintQueue
- func (queue *UintQueue) Equals(other *UintQueue) bool
- func (queue *UintQueue) Exists(p func(uint) bool) bool
- func (queue *UintQueue) Filter(p func(uint) bool) *UintQueue
- func (queue *UintQueue) Find(p func(uint) bool) (uint, bool)
- func (queue *UintQueue) FlatMap(f func(uint) []uint) *UintQueue
- func (queue *UintQueue) FlatMapToString(f func(uint) []string) []string
- func (queue *UintQueue) Fold(initial uint, fn func(uint, uint) uint) uint
- func (queue *UintQueue) Forall(p func(uint) bool) bool
- func (queue *UintQueue) Foreach(f func(uint))
- func (queue *UintQueue) Get(i int) uint
- func (queue *UintQueue) Head() uint
- func (queue *UintQueue) HeadOption() (uint, bool)
- func (queue *UintQueue) IsEmpty() bool
- func (queue *UintQueue) IsFull() bool
- func (queue *UintQueue) IsOverwriting() bool
- func (queue *UintQueue) IsSequence() bool
- func (queue *UintQueue) IsSet() bool
- func (queue *UintQueue) Last() uint
- func (queue *UintQueue) LastOption() (uint, bool)
- func (queue *UintQueue) Len() int
- func (queue *UintQueue) Less(i, j int) bool
- func (queue *UintQueue) Map(f func(uint) uint) *UintQueue
- func (queue *UintQueue) MapToString(f func(uint) string) []string
- func (queue UintQueue) MarshalJSON() ([]byte, error)
- func (queue *UintQueue) Max() (result uint)
- func (queue *UintQueue) MaxBy(less func(uint, uint) bool) uint
- func (queue *UintQueue) Min() uint
- func (queue *UintQueue) MinBy(less func(uint, uint) bool) uint
- func (queue *UintQueue) MkString(sep string) string
- func (queue *UintQueue) MkString3(before, between, after string) string
- func (queue *UintQueue) NonEmpty() bool
- func (queue *UintQueue) Offer(items ...uint) []uint
- func (queue *UintQueue) Partition(p func(uint) bool) (*UintQueue, *UintQueue)
- func (queue *UintQueue) Pop(n int) []uint
- func (queue *UintQueue) Pop1() (uint, bool)
- func (queue *UintQueue) Push(items ...uint) *UintQueue
- func (queue *UintQueue) Reallocate(capacity int, overwrite bool) *UintQueue
- func (queue *UintQueue) Send() <-chan uint
- func (queue *UintQueue) Size() int
- func (queue *UintQueue) Sort()
- func (queue *UintQueue) Space() int
- func (queue *UintQueue) StableSort()
- func (queue *UintQueue) String() string
- func (queue *UintQueue) StringList() []string
- func (queue *UintQueue) Sum() uint
- func (queue *UintQueue) Swap(i, j int)
- func (queue *UintQueue) ToInterfaceSlice() []interface{}
- func (queue *UintQueue) ToSlice() []uint
- func (queue *UintQueue) UnmarshalJSON(b []byte) error
- type UintSequence
- type UintSet
- func (set UintSet) Add(more ...uint) UintSet
- func (set UintSet) Append(more ...uint) UintSet
- func (set UintSet) Cardinality() int
- func (set *UintSet) Clear()
- func (set UintSet) Clone() UintSet
- func (set UintSet) Contains(i uint) bool
- func (set UintSet) ContainsAll(i ...uint) bool
- func (set UintSet) CountBy(p func(uint) bool) (result int)
- func (set UintSet) Difference(other UintSet) UintSet
- func (set UintSet) Equals(other UintSet) bool
- func (set UintSet) Exists(p func(uint) bool) bool
- func (set UintSet) Filter(p func(uint) bool) UintSet
- func (set UintSet) Find(p func(uint) bool) (uint, bool)
- func (set UintSet) FlatMap(f func(uint) []uint) UintSet
- func (set UintSet) FlatMapToString(f func(uint) []string) []string
- func (set UintSet) Fold(initial uint, fn func(uint, uint) uint) uint
- func (set UintSet) Forall(p func(uint) bool) bool
- func (set UintSet) Foreach(f func(uint))
- func (set UintSet) Intersect(other UintSet) UintSet
- func (set UintSet) IsEmpty() bool
- func (set UintSet) IsSequence() bool
- func (set UintSet) IsSet() bool
- func (set UintSet) IsSubset(other UintSet) bool
- func (set UintSet) IsSuperset(other UintSet) bool
- func (set UintSet) Map(f func(uint) uint) UintSet
- func (set UintSet) MapToString(f func(uint) string) []string
- func (set UintSet) MarshalJSON() ([]byte, error)
- func (set UintSet) Max() uint
- func (set UintSet) MaxBy(less func(uint, uint) bool) uint
- func (set UintSet) Min() uint
- func (set UintSet) MinBy(less func(uint, uint) bool) uint
- func (set UintSet) MkString(sep string) string
- func (set UintSet) MkString3(before, between, after string) string
- func (set UintSet) NonEmpty() bool
- func (set UintSet) Partition(p func(uint) bool) (UintSet, UintSet)
- func (set UintSet) Remove(i uint)
- func (set UintSet) Send() <-chan uint
- func (set UintSet) Size() int
- func (set UintSet) String() string
- func (set UintSet) StringList() []string
- func (set UintSet) StringMap() map[string]bool
- func (set UintSet) Sum() uint
- func (set UintSet) SymmetricDifference(other UintSet) UintSet
- func (set UintSet) ToInterfaceSlice() []interface{}
- func (set UintSet) ToList() UintList
- func (set UintSet) ToSet() UintSet
- func (set UintSet) ToSlice() []uint
- func (set UintSet) Union(other UintSet) UintSet
- func (set UintSet) UnmarshalJSON(b []byte) error
- type UintSizer
- type UintStringMap
- func (mm *UintStringMap) Clear()
- func (mm UintStringMap) Clone() UintStringMap
- func (mm UintStringMap) ContainsAllKeys(kk ...uint) bool
- func (mm UintStringMap) ContainsKey(k uint) bool
- func (mm UintStringMap) DropWhere(fn func(uint, string) bool) UintStringTuples
- func (mm UintStringMap) Equals(other UintStringMap) bool
- func (mm UintStringMap) Exists(p func(uint, string) bool) bool
- func (mm UintStringMap) Filter(p func(uint, string) bool) UintStringMap
- func (mm UintStringMap) Find(p func(uint, string) bool) (UintStringTuple, bool)
- func (mm UintStringMap) FlatMap(f func(uint, string) []UintStringTuple) UintStringMap
- func (mm UintStringMap) Forall(p func(uint, string) bool) bool
- func (mm UintStringMap) Foreach(f func(uint, string))
- func (mm UintStringMap) Get(k uint) (string, bool)
- func (mm UintStringMap) IsEmpty() bool
- func (mm UintStringMap) Keys() UintList
- func (mm UintStringMap) Map(f func(uint, string) (uint, string)) UintStringMap
- func (mm UintStringMap) MkString(sep string) string
- func (mm UintStringMap) MkString4(before, between, after, equals string) string
- func (mm UintStringMap) NonEmpty() bool
- func (mm UintStringMap) OrderedSlice(keys UintList) UintStringTuples
- func (mm UintStringMap) Partition(p func(uint, string) bool) (matching UintStringMap, others UintStringMap)
- func (mm UintStringMap) Pop(k uint) (string, bool)
- func (mm UintStringMap) Put(k uint, v string) bool
- func (mm UintStringMap) Remove(k uint)
- func (mm UintStringMap) Size() int
- func (mm UintStringMap) String() string
- func (mm UintStringMap) ToSlice() UintStringTuples
- func (mm UintStringMap) Values() StringList
- type UintStringTuple
- type UintStringTuples
- func (ts UintStringTuples) Append1(k uint, v string) UintStringTuples
- func (ts UintStringTuples) Append2(k1 uint, v1 string, k2 uint, v2 string) UintStringTuples
- func (ts UintStringTuples) Append3(k1 uint, v1 string, k2 uint, v2 string, k3 uint, v3 string) UintStringTuples
- func (ts UintStringTuples) MkString(sep string) string
- func (ts UintStringTuples) MkString4(before, between, after, equals string) string
- func (ts UintStringTuples) String() string
- func (ts UintStringTuples) ToMap() UintStringMap
- func (ts UintStringTuples) Values(values ...string) UintStringTuples
- type UintUintMap
- func (mm *UintUintMap) Clear()
- func (mm UintUintMap) Clone() UintUintMap
- func (mm UintUintMap) ContainsAllKeys(kk ...uint) bool
- func (mm UintUintMap) ContainsKey(k uint) bool
- func (mm UintUintMap) DropWhere(fn func(uint, uint) bool) UintUintTuples
- func (mm UintUintMap) Equals(other UintUintMap) bool
- func (mm UintUintMap) Exists(p func(uint, uint) bool) bool
- func (mm UintUintMap) Filter(p func(uint, uint) bool) UintUintMap
- func (mm UintUintMap) Find(p func(uint, uint) bool) (UintUintTuple, bool)
- func (mm UintUintMap) FlatMap(f func(uint, uint) []UintUintTuple) UintUintMap
- func (mm UintUintMap) Forall(p func(uint, uint) bool) bool
- func (mm UintUintMap) Foreach(f func(uint, uint))
- func (mm UintUintMap) Get(k uint) (uint, bool)
- func (mm UintUintMap) IsEmpty() bool
- func (mm UintUintMap) Keys() UintList
- func (mm UintUintMap) Map(f func(uint, uint) (uint, uint)) UintUintMap
- func (mm UintUintMap) MkString(sep string) string
- func (mm UintUintMap) MkString4(before, between, after, equals string) string
- func (mm UintUintMap) NonEmpty() bool
- func (mm UintUintMap) OrderedSlice(keys UintList) UintUintTuples
- func (mm UintUintMap) Partition(p func(uint, uint) bool) (matching UintUintMap, others UintUintMap)
- func (mm UintUintMap) Pop(k uint) (uint, bool)
- func (mm UintUintMap) Put(k uint, v uint) bool
- func (mm UintUintMap) Remove(k uint)
- func (mm UintUintMap) Size() int
- func (mm UintUintMap) String() string
- func (mm UintUintMap) ToSlice() UintUintTuples
- func (mm UintUintMap) Values() UintList
- type UintUintTuple
- type UintUintTuples
- func (ts UintUintTuples) Append1(k uint, v uint) UintUintTuples
- func (ts UintUintTuples) Append2(k1 uint, v1 uint, k2 uint, v2 uint) UintUintTuples
- func (ts UintUintTuples) Append3(k1 uint, v1 uint, k2 uint, v2 uint, k3 uint, v3 uint) UintUintTuples
- func (ts UintUintTuples) MkString(sep string) string
- func (ts UintUintTuples) MkString4(before, between, after, equals string) string
- func (ts UintUintTuples) String() string
- func (ts UintUintTuples) ToMap() UintUintMap
- func (ts UintUintTuples) Values(values ...uint) UintUintTuples
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 []interface{}
AnyList is a slice of type interface{}. Use it where you would use []interface{}. To add items to the list, simply use the normal built-in append function.
List values follow a similar pattern to Scala Lists and LinearSeqs in particular. 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
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 MakeAnyList ¶ added in v0.4.0
MakeAnyList makes an empty list with both length and capacity initialised.
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) Clone ¶ added in v0.4.0
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (AnyList) Contains ¶ added in v0.6.0
Contains determines whether a given item is already in the list, returning true if so.
func (AnyList) ContainsAll ¶ added in v0.6.0
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
CountBy gives the number elements of AnyList that return true for the predicate p.
func (AnyList) DistinctBy ¶ added in v0.4.0
DistinctBy returns a new AnyList whose elements are unique, where equality is defined by the equal function.
func (AnyList) DoReverse ¶ added in v0.4.0
DoReverse alters a AnyList with all elements in the reverse order. Unlike Reverse, it does not allocate new memory.
The list is modified and the modified list is returned.
func (AnyList) DoShuffle ¶ added in v0.4.0
DoShuffle returns a shuffled AnyList, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (AnyList) Drop ¶ added in v0.4.0
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.
The original list is not modified.
func (AnyList) DropLast ¶ added in v0.4.0
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.
The original list is not modified.
func (AnyList) DropWhile ¶ added in v0.4.0
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.
The original list is not modified.
func (AnyList) Equals ¶ added in v0.6.0
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal.
func (AnyList) Exists ¶ added in v0.4.0
Exists verifies that one or more elements of AnyList return true for the predicate p.
func (AnyList) Filter ¶ added in v0.4.0
Filter returns a new AnyList whose elements return true for predicate p.
The original list is not modified.
func (AnyList) Find ¶ added in v0.4.0
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
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. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (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
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.
func (AnyList) Get ¶ added in v0.4.0
Get gets the specified element in the list. Panics if the index is out of range or the list is nil. The simple list is a dressed-up slice and normal slice operations will also work.
func (AnyList) GobDecode ¶ added in v0.6.0
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
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
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (AnyList) IndexWhere ¶ added in v0.4.0
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
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
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) IsSequence ¶ added in v0.4.0
IsSequence returns true for lists and 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
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
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
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (AnyList) Len ¶ added in v0.4.0
Len returns the number of items in the list - an alias of Size(). This is one of the three methods in the standard sort.Interface.
func (AnyList) Map ¶ added in v0.4.0
Map returns a new AnyList by transforming every element with function f. The resulting list is the same size as the original list. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (AnyList) MaxBy ¶ added in v0.4.0
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
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
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (AnyList) MkString3 ¶ added in v0.6.0
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (AnyList) Partition ¶ added in v0.4.0
Partition returns two new AnyLists whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list.
The original list is not modified.
func (AnyList) Reverse ¶ added in v0.4.0
Reverse returns a copy of AnyList with all elements in the reverse order.
The original list is not modified.
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
Shuffle returns a shuffled copy of AnyList, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (AnyList) Size ¶ added in v0.4.0
Size returns the number of items in the list - an alias of Len().
func (AnyList) SortBy ¶ added in v0.4.0
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (AnyList) StableSortBy ¶ added in v0.4.0
StableSortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned. The algorithm keeps the original order of equal elements.
func (AnyList) String ¶ added in v0.6.0
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
StringList gets a list of strings that depicts all the elements.
func (AnyList) Swap ¶ added in v0.4.0
Swap exchanges two elements, which is necessary during sorting etc. This is one of the three methods in the standard sort.Interface.
func (AnyList) Tail ¶ added in v0.4.0
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
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
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.
The original list is not modified.
func (AnyList) TakeWhile ¶ added in v0.4.0
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.
The original list is not modified.
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
ToList returns the elements of the list as a list, which is an identity operation in this case.
type AnyMkStringer ¶ added in v0.6.0
type AnyMkStringer interface { // String implements the Stringer interface to render the collection 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 // StringList gets a collection of strings that depicts all the elements. StringList() []string }
AnyMkStringer defines an interface for stringer methods on interface{} collections.
type AnyQueue ¶ added in v0.9.0
type AnyQueue struct {
// contains filtered or unexported fields
}
AnyQueue is a ring buffer containing a slice of type interface{}. It is optimised for FIFO operations.
func BuildAnyQueueFromChan ¶ added in v0.9.0
func BuildAnyQueueFromChan(source <-chan interface{}) *AnyQueue
BuildAnyQueueFromChan constructs a new AnyQueue from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func NewAnyQueue ¶ added in v0.9.0
NewAnyQueue returns a new queue of interface{}. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue.
func NewAnySortedQueue ¶ added in v0.9.0
NewAnySortedQueue returns a new queue of interface{}. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue. If the 'less' comparison function is not nil, elements can be easily sorted.
func (*AnyQueue) Add ¶ added in v0.9.0
func (queue *AnyQueue) Add(more ...interface{})
Add adds items to the queue. This is a synonym for Push.
func (*AnyQueue) Clone ¶ added in v0.9.0
Clone returns a shallow copy of the queue. It does not clone the underlying elements.
func (*AnyQueue) Contains ¶ added in v0.9.0
Contains determines whether a given item is already in the queue, returning true if so.
func (*AnyQueue) ContainsAll ¶ added in v0.9.0
ContainsAll determines whether the given items are all in the queue, returning true if so. This is potentially a slow method and should only be used rarely.
func (*AnyQueue) CountBy ¶ added in v0.9.0
CountBy gives the number elements of AnyQueue that return true for the predicate p.
func (*AnyQueue) DoKeepWhere ¶ added in v0.9.0
DoKeepWhere modifies a AnyQueue by retaining only those elements that match the predicate p. This is very similar to Filter but alters the queue in place.
The queue is modified and the modified queue is returned.
func (*AnyQueue) Equals ¶ added in v0.9.0
Equals determines if two queues are equal to each other. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal. Nil queues are considered to be empty.
func (*AnyQueue) Exists ¶ added in v0.9.0
Exists verifies that one or more elements of AnyQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*AnyQueue) Filter ¶ added in v0.9.0
Filter returns a new AnyQueue whose elements return true for predicate p.
The original queue is not modified. See also DoKeepWhere (which does modify the original queue).
func (*AnyQueue) Find ¶ added in v0.9.0
Find returns the first interface{} that returns true for predicate p. False is returned if none match.
func (*AnyQueue) FlatMap ¶ added in v0.9.0
FlatMap returns a new AnyQueue by transforming every element with function f that returns zero or more items in a slice. The resulting queue may have a different size to the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*AnyQueue) Fold ¶ added in v0.9.0
func (queue *AnyQueue) Fold(initial interface{}, fn func(interface{}, interface{}) interface{}) interface{}
Fold aggregates all the values in the queue using a supplied function, starting from some initial value.
func (*AnyQueue) Forall ¶ added in v0.9.0
Forall verifies that all elements of AnyQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*AnyQueue) Foreach ¶ added in v0.9.0
func (queue *AnyQueue) Foreach(f func(interface{}))
Foreach iterates over AnyQueue and executes function f against each element. The function can safely alter the values via side-effects.
func (*AnyQueue) Get ¶ added in v0.9.0
Get gets the specified element in the queue. Panics if the index is out of range or the queue is nil.
func (*AnyQueue) Head ¶ added in v0.9.0
func (queue *AnyQueue) Head() interface{}
Head gets the first element in the queue. Head is the opposite of Last. Panics if queue is empty or nil.
func (*AnyQueue) HeadOption ¶ added in v0.9.0
HeadOption returns the oldest item in the queue without removing it. If the queue is nil or empty, it returns the zero value instead.
func (*AnyQueue) IsOverwriting ¶ added in v0.9.0
IsOverwriting returns true if the queue is overwriting, false if refusing.
func (*AnyQueue) IsSequence ¶ added in v0.9.0
IsSequence returns true for ordered lists and queues.
func (*AnyQueue) Last ¶ added in v0.9.0
func (queue *AnyQueue) Last() interface{}
Last gets the the newest item in the queue (i.e. last element pushed) without removing it. Last is the opposite of Head. Panics if queue is empty or nil.
func (*AnyQueue) LastOption ¶ added in v0.9.0
LastOption returns the newest item in the queue without removing it. If the queue is nil empty, it returns the zero value instead.
func (*AnyQueue) Len ¶ added in v0.9.0
Len gets the current length of this queue. This is an alias for Size.
func (*AnyQueue) Less ¶ added in v0.9.0
Less reports whether the element with index i should sort before the element with index j. The queue must have been created with a non-nil 'less' comparison function and it must not be empty.
func (*AnyQueue) Map ¶ added in v0.9.0
Map returns a new AnyQueue by transforming every element with function f. The resulting queue is the same size as the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (AnyQueue) MarshalJSON ¶ added in v0.9.0
MarshalJSON implements JSON encoding for this queue type.
func (*AnyQueue) MaxBy ¶ added in v0.9.0
MaxBy returns an element of AnyQueue 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 (*AnyQueue) MinBy ¶ added in v0.9.0
MinBy returns an element of AnyQueue 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 (*AnyQueue) MkString ¶ added in v0.9.0
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*AnyQueue) MkString3 ¶ added in v0.9.0
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*AnyQueue) Offer ¶ added in v0.9.0
func (queue *AnyQueue) Offer(items ...interface{}) []interface{}
Offer appends as many items to the end of the queue as it can. If the queue is already full, what happens depends on whether the queue is configured to overwrite. If it is, the oldest items will be overwritten. Otherwise, it will be filled to capacity and any unwritten items are returned.
If the capacity is too small for the number of items, the excess items are returned. The queue capacity is never altered.
func (*AnyQueue) Partition ¶ added in v0.9.0
Partition returns two new AnyQueues 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 queue.
The original queue is not modified
func (*AnyQueue) Pop ¶ added in v0.9.0
Pop removes and returns the oldest items from the queue. If the queue is empty, it returns a nil slice. If n is larger than the current queue length, it returns all the available elements, so in this case the returned slice will be shorter than n.
func (*AnyQueue) Pop1 ¶ added in v0.9.0
Pop1 removes and returns the oldest item from the queue. If the queue is empty, it returns the zero value instead. The boolean is true only if the element was available.
func (*AnyQueue) Push ¶ added in v0.9.0
Push appends items to the end of the queue. If the queue does not have enough space, more will be allocated: how this happens depends on the overwriting mode.
When overwriting, the oldest items are overwritten with the new data; it expands the queue only if there is still not enough space.
Otherwise, the queue might be reallocated if necessary, ensuring that all the data is pushed without any older items being affected.
The modified queue is returned.
func (*AnyQueue) Reallocate ¶ added in v0.9.0
Reallocate adjusts the allocated capacity of the queue and allows the overwriting behaviour to be changed.
If the new queue capacity is different to the current capacity, the queue is re-allocated to the new capacity. If this is less than the current number of elements, the oldest items in the queue are discarded so that the remaining data can fit in the new space available.
If the new queue capacity is the same as the current capacity, the queue is not altered except for adopting the new overwrite flag's value. Therefore this is the means to change the overwriting behaviour.
Reallocate adjusts the storage space but does not clone the underlying elements.
The queue must not be nil.
func (*AnyQueue) Send ¶ added in v0.9.0
func (queue *AnyQueue) 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 (*AnyQueue) Size ¶ added in v0.9.0
Size gets the number of elements currently in this queue. This is an alias for Len.
func (*AnyQueue) Sort ¶ added in v0.9.0
func (queue *AnyQueue) Sort()
Sort sorts the queue using the 'less' comparison function, which must not be nil. This function will panic if the collection was created with a nil 'less' function (see NewAnySortedQueue).
func (*AnyQueue) StableSort ¶ added in v0.9.0
func (queue *AnyQueue) StableSort()
StableSort sorts the queue using the 'less' comparison function, which must not be nil. The result is stable so that repeated calls will not arbitrarily swap equal items. This function will panic if the collection was created with a nil 'less' function (see NewAnySortedQueue).
func (*AnyQueue) String ¶ added in v0.9.0
String implements the Stringer interface to render the queue as a comma-separated string enclosed in square brackets.
func (*AnyQueue) StringList ¶ added in v0.9.0
StringList gets a list of strings that depicts all the elements.
func (*AnyQueue) Swap ¶ added in v0.9.0
Swap swaps the elements with indexes i and j. The queue must not be empty.
func (*AnyQueue) ToInterfaceSlice ¶ added in v0.9.0
func (queue *AnyQueue) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the queue as a slice of arbitrary type. The queue is not altered.
func (*AnyQueue) ToSlice ¶ added in v0.9.0
func (queue *AnyQueue) ToSlice() []interface{}
ToSlice returns the elements of the queue as a slice. The queue is not altered.
func (*AnyQueue) UnmarshalJSON ¶ added in v0.9.0
UnmarshalJSON implements JSON decoding for this queue type.
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 map[interface{}]struct{}
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
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) Append ¶ added in v0.4.0
Append inserts more items into a clone of the set. It returns the augmented set. The original set is unmodified.
func (AnySet) Cardinality ¶ added in v0.4.0
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*AnySet) Clear ¶ added in v0.4.0
func (set *AnySet) Clear()
Clear the entire set. Aterwards, it will be an empty set.
func (AnySet) Clone ¶ added in v0.4.0
Clone returns a shallow copy of the set. It does not clone the underlying elements.
func (AnySet) Contains ¶ added in v0.4.0
Contains determines whether a given item is already in the set, returning true if so.
func (AnySet) ContainsAll ¶ added in v0.4.0
ContainsAll determines whether a given item is already in the set, returning true if so.
func (AnySet) CountBy ¶ added in v0.4.0
CountBy gives the number elements of AnySet that return true for the predicate p.
func (AnySet) Difference ¶ added in v0.4.0
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
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
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
Filter returns a new AnySet whose elements return true for the predicate p.
The original set is not modified
func (AnySet) Find ¶ added in v0.4.0
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
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. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (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
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 the set and executes the function f against each element.
func (AnySet) Intersect ¶ added in v0.4.0
Intersect returns a new set with items that exist only in both sets.
func (AnySet) IsSequence ¶ added in v0.4.0
IsSequence returns true for lists and queues.
func (AnySet) IsSubset ¶ added in v0.4.0
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
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
Map returns a new AnySet by transforming every element with a function f. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (AnySet) MarshalJSON ¶ added in v0.6.0
MarshalJSON implements JSON encoding for this set type.
func (AnySet) MaxBy ¶ added in v0.4.0
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
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
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (AnySet) MkString3 ¶ added in v0.6.0
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (AnySet) Partition ¶ added in v0.4.0
Partition returns two new AnySets 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 original set is not modified
func (AnySet) Remove ¶ added in v0.4.0
func (set AnySet) Remove(i interface{})
Remove a single item from the set.
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
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (AnySet) String ¶ added in v0.6.0
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
StringList gets a list of strings that depicts all the elements.
func (AnySet) StringMap ¶ added in v0.6.0
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
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
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
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) UnmarshalJSON ¶ added in v0.6.0
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 collection - an alias of Len(). Size() int }
AnySizer defines an interface for sizing methods on interface{} collections.
type Int64Collection ¶
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) // 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 ¶
Int64Int64Map is the primary type that represents a map
func NewInt64Int64Map ¶
func NewInt64Int64Map(kv ...Int64Int64Tuple) Int64Int64Map
NewInt64Int64Map creates and returns a reference to a map, optionally containing some items.
func NewInt64Int64Map1 ¶
func NewInt64Int64Map1(k int64, v int64) Int64Int64Map
NewInt64Int64Map1 creates and returns a reference to a map containing one item.
func (Int64Int64Map) Clone ¶
func (mm Int64Int64Map) Clone() Int64Int64Map
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (Int64Int64Map) ContainsAllKeys ¶
func (mm Int64Int64Map) ContainsAllKeys(kk ...int64) bool
ContainsAllKeys determines if the given items are all in the map.
func (Int64Int64Map) ContainsKey ¶
func (mm Int64Int64Map) ContainsKey(k int64) bool
ContainsKey determines if a given item is already in the map.
func (Int64Int64Map) DropWhere ¶
func (mm Int64Int64Map) DropWhere(fn func(int64, int64) bool) Int64Int64Tuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
func (Int64Int64Map) Equals ¶
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 ¶
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 ¶
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. The original map is not modified.
func (Int64Int64Map) Find ¶
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. The original map is not modified.
func (Int64Int64Map) FlatMap ¶
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64Int64Map) Forall ¶
func (mm Int64Int64Map) Forall(p 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 ¶
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 ¶
func (mm Int64Int64Map) Get(k int64) (int64, bool)
Get returns one of the items in the map, if present.
func (Int64Int64Map) IsEmpty ¶
func (mm Int64Int64Map) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (Int64Int64Map) Keys ¶
func (mm Int64Int64Map) Keys() Int64List
Keys returns the keys of the current map as a slice.
func (Int64Int64Map) Map ¶
func (mm Int64Int64Map) Map(f func(int64, int64) (int64, int64)) Int64Int64Map
Map returns a new Int64Map by transforming every element with the function f. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64Int64Map) MkString ¶
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 ¶
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 Int64List) Int64Int64Tuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (Int64Int64Map) Partition ¶
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. The original map is not modified.
func (Int64Int64Map) Pop ¶
func (mm Int64Int64Map) Pop(k int64) (int64, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (Int64Int64Map) Put ¶
func (mm Int64Int64Map) Put(k int64, v int64) bool
Put adds an item to the current map, replacing any prior value.
func (Int64Int64Map) Remove ¶
func (mm Int64Int64Map) Remove(k int64)
Remove a single item from the map.
func (Int64Int64Map) Size ¶
func (mm Int64Int64Map) Size() int
Size returns how many items are currently in the map. This is a synonym for Len.
func (Int64Int64Map) String ¶
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 ¶
func (mm Int64Int64Map) ToSlice() Int64Int64Tuples
ToSlice returns the key/value pairs as a slice.
func (Int64Int64Map) Values ¶
func (mm Int64Int64Map) Values() Int64List
Values returns the values of the current map as a slice.
type Int64Int64Tuple ¶
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 ¶
type Int64Int64Tuples []Int64Int64Tuple
Int64Int64Tuples can be used as a builder for unmodifiable maps.
func Int64Int64Zip ¶
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 ¶
func (ts Int64Int64Tuples) Append1(k int64, v int64) Int64Int64Tuples
Append1 adds one item.
func (Int64Int64Tuples) Append2 ¶
func (ts Int64Int64Tuples) Append2(k1 int64, v1 int64, k2 int64, v2 int64) Int64Int64Tuples
Append2 adds two items.
func (Int64Int64Tuples) Append3 ¶
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 ¶
func (ts Int64Int64Tuples) Values(values ...int64) Int64Int64Tuples
Values sets the values in a tuple slice. Use this with Int64Int64Zip.
type Int64List ¶
type Int64List []int64
Int64List is a slice of type int64. Use it where you would use []int64. To add items to the list, simply use the normal built-in append function.
List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq
func BuildInt64ListFromChan ¶
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 ¶
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 MakeInt64List ¶
MakeInt64List makes an empty list with both length and capacity initialised.
func NewInt64List ¶
NewInt64List constructs a new list containing the supplied values, if any.
func (Int64List) Clone ¶
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (Int64List) Contains ¶
Contains determines whether a given item is already in the list, returning true if so.
func (Int64List) ContainsAll ¶
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 ¶
CountBy gives the number elements of Int64List that return true for the predicate p.
func (Int64List) DistinctBy ¶
DistinctBy returns a new Int64List whose elements are unique, where equality is defined by the equal function.
func (Int64List) DoReverse ¶
DoReverse alters a Int64List with all elements in the reverse order. Unlike Reverse, it does not allocate new memory.
The list is modified and the modified list is returned.
func (Int64List) DoShuffle ¶
DoShuffle returns a shuffled Int64List, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (Int64List) Drop ¶
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.
The original list is not modified.
func (Int64List) DropLast ¶
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.
The original list is not modified.
func (Int64List) DropWhile ¶
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.
The original list is not modified.
func (Int64List) Equals ¶
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal.
func (Int64List) Exists ¶
Exists verifies that one or more elements of Int64List return true for the predicate p.
func (Int64List) Filter ¶
Filter returns a new Int64List whose elements return true for predicate p.
The original list is not modified.
func (Int64List) Find ¶
Find returns the first int64 that returns true for predicate p. False is returned if none match.
func (Int64List) FlatMap ¶
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. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64List) FlatMapToString ¶ added in v0.3.0
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. The list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64List) Fold ¶ added in v0.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (Int64List) Forall ¶
Forall verifies that all elements of Int64List return true for the predicate p.
func (Int64List) Foreach ¶
Foreach iterates over Int64List and executes function f against each element.
func (Int64List) Get ¶
Get gets the specified element in the list. Panics if the index is out of range or the list is nil. The simple list is a dressed-up slice and normal slice operations will also work.
func (Int64List) GobDecode ¶
GobDecode implements 'gob' decoding for this list type. You must register int64 with the 'gob' package before this method is used.
func (Int64List) GobEncode ¶
GobEncode implements 'gob' encoding for this list type. You must register int64 with the 'gob' package before this method is used.
func (Int64List) Head ¶
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 ¶
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (Int64List) IndexWhere ¶
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (Int64List) IndexWhere2 ¶
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 ¶
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) IsSequence ¶
IsSequence returns true for lists and queues.
func (Int64List) Last ¶
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 ¶
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (Int64List) LastIndexWhere2 ¶
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 ¶
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (Int64List) Len ¶
Len returns the number of items in the list - an alias of Size(). This is one of the three methods in the standard sort.Interface.
func (Int64List) Map ¶
Map returns a new Int64List by transforming every element with function f. The resulting list is the same size as the original list. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64List) MapToString ¶ added in v0.3.0
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the list. The list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64List) Max ¶
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (Int64List) MaxBy ¶
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 ¶
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (Int64List) MinBy ¶
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 ¶
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (Int64List) MkString3 ¶
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (Int64List) Partition ¶
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.
The original list is not modified.
func (Int64List) Reverse ¶
Reverse returns a copy of Int64List with all elements in the reverse order.
The original list is not modified.
func (Int64List) Send ¶
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed. The channel will be closed when all the elements have been sent.
func (Int64List) Shuffle ¶
Shuffle returns a shuffled copy of Int64List, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (Int64List) SortBy ¶
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (Int64List) Sorted ¶
Sorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (Int64List) StableSortBy ¶
StableSortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned. The algorithm keeps the original order of equal elements.
func (Int64List) StableSorted ¶
StableSorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (Int64List) String ¶
String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.
func (Int64List) StringList ¶
StringList gets a list of strings that depicts all the elements.
func (Int64List) Swap ¶
Swap exchanges two elements, which is necessary during sorting etc. This is one of the three methods in the standard sort.Interface.
func (Int64List) Tail ¶
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 ¶
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 ¶
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.
The original list is not modified.
func (Int64List) TakeWhile ¶
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.
The original list is not modified.
func (Int64List) ToInterfaceSlice ¶
func (list Int64List) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (Int64List) ToList ¶
ToList returns the elements of the list as a list, which is an identity operation in this case.
type Int64MkStringer ¶
type Int64MkStringer interface { // String implements the Stringer interface to render the collection 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 // StringList gets a collection of strings that depicts all the elements. StringList() []string }
Int64MkStringer defines an interface for stringer methods on int64 collections.
type Int64Queue ¶ added in v0.9.0
type Int64Queue struct {
// contains filtered or unexported fields
}
Int64Queue is a ring buffer containing a slice of type int64. It is optimised for FIFO operations.
func BuildInt64QueueFromChan ¶ added in v0.9.0
func BuildInt64QueueFromChan(source <-chan int64) *Int64Queue
BuildInt64QueueFromChan constructs a new Int64Queue from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func NewInt64Queue ¶ added in v0.9.0
func NewInt64Queue(capacity int, overwrite bool) *Int64Queue
NewInt64Queue returns a new queue of int64. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue.
func NewInt64SortedQueue ¶ added in v0.9.0
func NewInt64SortedQueue(capacity int, overwrite bool, less func(i, j int64) bool) *Int64Queue
NewInt64SortedQueue returns a new queue of int64. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue. If the 'less' comparison function is not nil, elements can be easily sorted.
func (*Int64Queue) Add ¶ added in v0.9.0
func (queue *Int64Queue) Add(more ...int64)
Add adds items to the queue. This is a synonym for Push.
func (*Int64Queue) Cap ¶ added in v0.9.0
func (queue *Int64Queue) Cap() int
Cap gets the capacity of this queue.
func (*Int64Queue) Clone ¶ added in v0.9.0
func (queue *Int64Queue) Clone() *Int64Queue
Clone returns a shallow copy of the queue. It does not clone the underlying elements.
func (*Int64Queue) Contains ¶ added in v0.9.0
func (queue *Int64Queue) Contains(v int64) bool
Contains determines whether a given item is already in the queue, returning true if so.
func (*Int64Queue) ContainsAll ¶ added in v0.9.0
func (queue *Int64Queue) ContainsAll(i ...int64) bool
ContainsAll determines whether the given items are all in the queue, returning true if so. This is potentially a slow method and should only be used rarely.
func (*Int64Queue) CountBy ¶ added in v0.9.0
func (queue *Int64Queue) CountBy(p func(int64) bool) (result int)
CountBy gives the number elements of Int64Queue that return true for the predicate p.
func (*Int64Queue) DoKeepWhere ¶ added in v0.9.0
func (queue *Int64Queue) DoKeepWhere(p func(int64) bool) *Int64Queue
DoKeepWhere modifies a Int64Queue by retaining only those elements that match the predicate p. This is very similar to Filter but alters the queue in place.
The queue is modified and the modified queue is returned.
func (*Int64Queue) Equals ¶ added in v0.9.0
func (queue *Int64Queue) Equals(other *Int64Queue) bool
Equals determines if two queues are equal to each other. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal. Nil queues are considered to be empty.
func (*Int64Queue) Exists ¶ added in v0.9.0
func (queue *Int64Queue) Exists(p func(int64) bool) bool
Exists verifies that one or more elements of Int64Queue return true for the predicate p. The function should not alter the values via side-effects.
func (*Int64Queue) Filter ¶ added in v0.9.0
func (queue *Int64Queue) Filter(p func(int64) bool) *Int64Queue
Filter returns a new Int64Queue whose elements return true for predicate p.
The original queue is not modified. See also DoKeepWhere (which does modify the original queue).
func (*Int64Queue) Find ¶ added in v0.9.0
func (queue *Int64Queue) 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 (*Int64Queue) FlatMap ¶ added in v0.9.0
func (queue *Int64Queue) FlatMap(f func(int64) []int64) *Int64Queue
FlatMap returns a new Int64Queue by transforming every element with function f that returns zero or more items in a slice. The resulting queue may have a different size to the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*Int64Queue) FlatMapToString ¶ added in v0.9.0
func (queue *Int64Queue) 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 queue. The queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*Int64Queue) Fold ¶ added in v0.9.0
Fold aggregates all the values in the queue using a supplied function, starting from some initial value.
func (*Int64Queue) Forall ¶ added in v0.9.0
func (queue *Int64Queue) Forall(p func(int64) bool) bool
Forall verifies that all elements of Int64Queue return true for the predicate p. The function should not alter the values via side-effects.
func (*Int64Queue) Foreach ¶ added in v0.9.0
func (queue *Int64Queue) Foreach(f func(int64))
Foreach iterates over Int64Queue and executes function f against each element. The function can safely alter the values via side-effects.
func (*Int64Queue) Get ¶ added in v0.9.0
func (queue *Int64Queue) Get(i int) int64
Get gets the specified element in the queue. Panics if the index is out of range or the queue is nil.
func (*Int64Queue) Head ¶ added in v0.9.0
func (queue *Int64Queue) Head() int64
Head gets the first element in the queue. Head is the opposite of Last. Panics if queue is empty or nil.
func (*Int64Queue) HeadOption ¶ added in v0.9.0
func (queue *Int64Queue) HeadOption() (int64, bool)
HeadOption returns the oldest item in the queue without removing it. If the queue is nil or empty, it returns the zero value instead.
func (*Int64Queue) IsEmpty ¶ added in v0.9.0
func (queue *Int64Queue) IsEmpty() bool
IsEmpty returns true if the queue is empty.
func (*Int64Queue) IsFull ¶ added in v0.9.0
func (queue *Int64Queue) IsFull() bool
IsFull returns true if the queue is full.
func (*Int64Queue) IsOverwriting ¶ added in v0.9.0
func (queue *Int64Queue) IsOverwriting() bool
IsOverwriting returns true if the queue is overwriting, false if refusing.
func (*Int64Queue) IsSequence ¶ added in v0.9.0
func (queue *Int64Queue) IsSequence() bool
IsSequence returns true for ordered lists and queues.
func (*Int64Queue) IsSet ¶ added in v0.9.0
func (queue *Int64Queue) IsSet() bool
IsSet returns false for lists or queues.
func (*Int64Queue) Last ¶ added in v0.9.0
func (queue *Int64Queue) Last() int64
Last gets the the newest item in the queue (i.e. last element pushed) without removing it. Last is the opposite of Head. Panics if queue is empty or nil.
func (*Int64Queue) LastOption ¶ added in v0.9.0
func (queue *Int64Queue) LastOption() (int64, bool)
LastOption returns the newest item in the queue without removing it. If the queue is nil empty, it returns the zero value instead.
func (*Int64Queue) Len ¶ added in v0.9.0
func (queue *Int64Queue) Len() int
Len gets the current length of this queue. This is an alias for Size.
func (*Int64Queue) Less ¶ added in v0.9.0
func (queue *Int64Queue) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j. The queue must have been created with a non-nil 'less' comparison function and it must not be empty.
func (*Int64Queue) Map ¶ added in v0.9.0
func (queue *Int64Queue) Map(f func(int64) int64) *Int64Queue
Map returns a new Int64Queue by transforming every element with function f. The resulting queue is the same size as the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*Int64Queue) MapToString ¶ added in v0.9.0
func (queue *Int64Queue) 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 queue. The queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64Queue) MarshalJSON ¶ added in v0.9.0
func (queue Int64Queue) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this queue type.
func (*Int64Queue) Max ¶ added in v0.9.0
func (queue *Int64Queue) Max() (result int64)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (*Int64Queue) MaxBy ¶ added in v0.9.0
func (queue *Int64Queue) MaxBy(less func(int64, int64) bool) int64
MaxBy returns an element of Int64Queue 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 (*Int64Queue) Min ¶ added in v0.9.0
func (queue *Int64Queue) Min() int64
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (*Int64Queue) MinBy ¶ added in v0.9.0
func (queue *Int64Queue) MinBy(less func(int64, int64) bool) int64
MinBy returns an element of Int64Queue 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 (*Int64Queue) MkString ¶ added in v0.9.0
func (queue *Int64Queue) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*Int64Queue) MkString3 ¶ added in v0.9.0
func (queue *Int64Queue) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*Int64Queue) NonEmpty ¶ added in v0.9.0
func (queue *Int64Queue) NonEmpty() bool
NonEmpty returns true if the queue is not empty.
func (*Int64Queue) Offer ¶ added in v0.9.0
func (queue *Int64Queue) Offer(items ...int64) []int64
Offer appends as many items to the end of the queue as it can. If the queue is already full, what happens depends on whether the queue is configured to overwrite. If it is, the oldest items will be overwritten. Otherwise, it will be filled to capacity and any unwritten items are returned.
If the capacity is too small for the number of items, the excess items are returned. The queue capacity is never altered.
func (*Int64Queue) Partition ¶ added in v0.9.0
func (queue *Int64Queue) Partition(p func(int64) bool) (*Int64Queue, *Int64Queue)
Partition returns two new Int64Queues 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 queue.
The original queue is not modified
func (*Int64Queue) Pop ¶ added in v0.9.0
func (queue *Int64Queue) Pop(n int) []int64
Pop removes and returns the oldest items from the queue. If the queue is empty, it returns a nil slice. If n is larger than the current queue length, it returns all the available elements, so in this case the returned slice will be shorter than n.
func (*Int64Queue) Pop1 ¶ added in v0.9.0
func (queue *Int64Queue) Pop1() (int64, bool)
Pop1 removes and returns the oldest item from the queue. If the queue is empty, it returns the zero value instead. The boolean is true only if the element was available.
func (*Int64Queue) Push ¶ added in v0.9.0
func (queue *Int64Queue) Push(items ...int64) *Int64Queue
Push appends items to the end of the queue. If the queue does not have enough space, more will be allocated: how this happens depends on the overwriting mode.
When overwriting, the oldest items are overwritten with the new data; it expands the queue only if there is still not enough space.
Otherwise, the queue might be reallocated if necessary, ensuring that all the data is pushed without any older items being affected.
The modified queue is returned.
func (*Int64Queue) Reallocate ¶ added in v0.9.0
func (queue *Int64Queue) Reallocate(capacity int, overwrite bool) *Int64Queue
Reallocate adjusts the allocated capacity of the queue and allows the overwriting behaviour to be changed.
If the new queue capacity is different to the current capacity, the queue is re-allocated to the new capacity. If this is less than the current number of elements, the oldest items in the queue are discarded so that the remaining data can fit in the new space available.
If the new queue capacity is the same as the current capacity, the queue is not altered except for adopting the new overwrite flag's value. Therefore this is the means to change the overwriting behaviour.
Reallocate adjusts the storage space but does not clone the underlying elements.
The queue must not be nil.
func (*Int64Queue) Send ¶ added in v0.9.0
func (queue *Int64Queue) 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 (*Int64Queue) Size ¶ added in v0.9.0
func (queue *Int64Queue) Size() int
Size gets the number of elements currently in this queue. This is an alias for Len.
func (*Int64Queue) Sort ¶ added in v0.9.0
func (queue *Int64Queue) Sort()
Sort sorts the queue using the 'less' comparison function, which must not be nil. This function will panic if the collection was created with a nil 'less' function (see NewInt64SortedQueue).
func (*Int64Queue) Space ¶ added in v0.9.0
func (queue *Int64Queue) Space() int
Space returns the space available in the queue.
func (*Int64Queue) StableSort ¶ added in v0.9.0
func (queue *Int64Queue) StableSort()
StableSort sorts the queue using the 'less' comparison function, which must not be nil. The result is stable so that repeated calls will not arbitrarily swap equal items. This function will panic if the collection was created with a nil 'less' function (see NewInt64SortedQueue).
func (*Int64Queue) String ¶ added in v0.9.0
func (queue *Int64Queue) String() string
String implements the Stringer interface to render the queue as a comma-separated string enclosed in square brackets.
func (*Int64Queue) StringList ¶ added in v0.9.0
func (queue *Int64Queue) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (*Int64Queue) Sum ¶ added in v0.9.0
func (queue *Int64Queue) Sum() int64
Sum returns the sum of all the elements in the queue.
func (*Int64Queue) Swap ¶ added in v0.9.0
func (queue *Int64Queue) Swap(i, j int)
Swap swaps the elements with indexes i and j. The queue must not be empty.
func (*Int64Queue) ToInterfaceSlice ¶ added in v0.9.0
func (queue *Int64Queue) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the queue as a slice of arbitrary type. The queue is not altered.
func (*Int64Queue) ToSlice ¶ added in v0.9.0
func (queue *Int64Queue) ToSlice() []int64
ToSlice returns the elements of the queue as a slice. The queue is not altered.
func (*Int64Queue) UnmarshalJSON ¶ added in v0.9.0
func (queue *Int64Queue) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this queue type.
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 ¶
type Int64Set map[int64]struct{}
Int64Set is the primary type that represents a set
func BuildInt64SetFromChan ¶
BuildInt64SetFromChan constructs a new Int64Set from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertInt64Set ¶
ConvertInt64Set constructs a new set containing the supplied values, if any. The returned boolean will be false if any of the values could not be converted correctly. The returned set will contain all the values that were correctly converted.
func NewInt64Set ¶
NewInt64Set creates and returns a reference to an empty set.
func (Int64Set) Append ¶
Append inserts more items into a clone of the set. It returns the augmented set. The original set is unmodified.
func (Int64Set) Cardinality ¶
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*Int64Set) Clear ¶
func (set *Int64Set) Clear()
Clear the entire set. Aterwards, it will be an empty set.
func (Int64Set) Clone ¶
Clone returns a shallow copy of the set. It does not clone the underlying elements.
func (Int64Set) Contains ¶
Contains determines whether a given item is already in the set, returning true if so.
func (Int64Set) ContainsAll ¶
ContainsAll determines whether a given item is already in the set, returning true if so.
func (Int64Set) CountBy ¶
CountBy gives the number elements of Int64Set that return true for the predicate p.
func (Int64Set) Difference ¶
Difference returns a new set with items in the current set but not in the other set
func (Int64Set) Equals ¶
Equals determines 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 ¶
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 ¶
Filter returns a new Int64Set whose elements return true for the predicate p.
The original set is not modified
func (Int64Set) Find ¶
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 ¶
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. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64Set) FlatMapToString ¶
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. The set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64Set) Fold ¶ added in v0.9.0
Fold aggregates all the values in the set using a supplied function, starting from some initial value.
func (Int64Set) Forall ¶
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 ¶
Foreach iterates over the set and executes the function f against each element.
func (Int64Set) IsSequence ¶
IsSequence returns true for lists and queues.
func (Int64Set) IsSubset ¶
IsSubset determines whether every item in the other set is in this set, returning true if so.
func (Int64Set) IsSuperset ¶
IsSuperset determines whether every item of this set is in the other set, returning true if so.
func (Int64Set) Map ¶
Map returns a new Int64Set by transforming every element with a function f. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64Set) MapToString ¶
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set. The set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64Set) MarshalJSON ¶
MarshalJSON implements JSON encoding for this set type.
func (Int64Set) Max ¶
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (Int64Set) MaxBy ¶
MaxBy returns an element of Int64Set containing the maximum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally maximal, the first such element is returned. Panics if there are no elements.
func (Int64Set) Min ¶
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (Int64Set) MinBy ¶
MinBy returns an element of Int64Set containing the minimum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally minimal, the first such element is returned. Panics if there are no elements.
func (Int64Set) MkString ¶
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (Int64Set) MkString3 ¶
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (Int64Set) Partition ¶
Partition returns two new Int64Sets whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't.
The original set is not modified
func (Int64Set) Send ¶
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed
func (Int64Set) Size ¶
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (Int64Set) String ¶
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (Int64Set) StringList ¶
StringList gets a list of strings that depicts all the elements.
func (Int64Set) StringMap ¶
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) SymmetricDifference ¶
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (Int64Set) ToInterfaceSlice ¶
func (set Int64Set) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.
func (Int64Set) ToList ¶
ToList returns the elements of the set as a list. The returned list is a shallow copy; the set is not altered.
func (Int64Set) UnmarshalJSON ¶
UnmarshalJSON implements JSON decoding for this set type.
type Int64Sizer ¶
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 collection - an alias of Len(). Size() int }
Int64Sizer defines an interface for sizing methods on int64 collections.
type Int64StringMap ¶ added in v0.4.0
Int64StringMap is the primary type that represents a 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) Clear ¶ added in v0.4.0
func (mm *Int64StringMap) Clear()
Clear clears the entire map.
func (Int64StringMap) Clone ¶ added in v0.4.0
func (mm Int64StringMap) Clone() Int64StringMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
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) DropWhere ¶ added in v0.4.0
func (mm Int64StringMap) DropWhere(fn func(int64, string) bool) Int64StringTuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
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. The original map is not modified.
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. The original map is not modified.
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Int64StringMap) Forall ¶ added in v0.4.0
func (mm Int64StringMap) Forall(p 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) 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() 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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (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 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. The original map is not modified.
func (Int64StringMap) Pop ¶ added in v0.4.0
func (mm Int64StringMap) Pop(k int64) (string, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (Int64StringMap) Put ¶ added in v0.4.0
func (mm Int64StringMap) Put(k int64, v string) bool
Put adds an item to the current map, replacing any prior value.
func (Int64StringMap) Remove ¶ added in v0.4.0
func (mm Int64StringMap) Remove(k int64)
Remove a single item from the 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() StringList
Values returns the values of the current map as a slice.
type Int64StringTuple ¶ added in v0.4.0
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
func (ts Int64StringTuples) Append1(k int64, v string) Int64StringTuples
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 ¶
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) // 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 ¶
IntIntMap is the primary type that represents a map
func NewIntIntMap ¶
func NewIntIntMap(kv ...IntIntTuple) IntIntMap
NewIntIntMap creates and returns a reference to a map, optionally containing some items.
func NewIntIntMap1 ¶
NewIntIntMap1 creates and returns a reference to a map containing one item.
func (IntIntMap) Clone ¶
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (IntIntMap) ContainsAllKeys ¶
ContainsAllKeys determines if the given items are all in the map.
func (IntIntMap) ContainsKey ¶
ContainsKey determines if a given item is already in the map.
func (IntIntMap) DropWhere ¶
func (mm IntIntMap) DropWhere(fn func(int, int) bool) IntIntTuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
func (IntIntMap) Equals ¶
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 ¶
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 ¶
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. The original map is not modified.
func (IntIntMap) Find ¶
Find returns the first int that returns true for the predicate p. False is returned if none match. The original map is not modified.
func (IntIntMap) FlatMap ¶
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntIntMap) Forall ¶
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 ¶
Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.
func (IntIntMap) Map ¶
Map returns a new IntMap by transforming every element with the function f. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntIntMap) MkString ¶
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
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (IntIntMap) OrderedSlice ¶ added in v0.6.0
func (mm IntIntMap) OrderedSlice(keys IntList) IntIntTuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (IntIntMap) Partition ¶
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. The original map is not modified.
func (IntIntMap) Pop ¶
Pop removes a single item from the map, returning the value present prior to removal.
func (IntIntMap) Size ¶
Size returns how many items are currently in the map. This is a synonym for Len.
func (IntIntMap) String ¶
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (IntIntMap) ToSlice ¶
func (mm IntIntMap) ToSlice() IntIntTuples
ToSlice returns the key/value pairs as a slice.
type IntIntTuple ¶
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 ¶
type IntIntTuples []IntIntTuple
IntIntTuples can be used as a builder for unmodifiable maps.
func IntIntZip ¶
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 ¶
func (ts IntIntTuples) Append1(k int, v int) IntIntTuples
Append1 adds one item.
func (IntIntTuples) Append2 ¶
func (ts IntIntTuples) Append2(k1 int, v1 int, k2 int, v2 int) IntIntTuples
Append2 adds two items.
func (IntIntTuples) Append3 ¶
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 ¶
func (ts IntIntTuples) Values(values ...int) IntIntTuples
Values sets the values in a tuple slice. Use this with IntIntZip.
type IntList ¶
type IntList []int
IntList is a slice of type int. Use it where you would use []int. To add items to the list, simply use the normal built-in append function.
List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq
func BuildIntListFromChan ¶
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 ¶
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 MakeIntList ¶
MakeIntList makes an empty list with both length and capacity initialised.
func NewIntList ¶
NewIntList constructs a new list containing the supplied values, if any.
func (IntList) Clone ¶
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (IntList) Contains ¶
Contains determines whether a given item is already in the list, returning true if so.
func (IntList) ContainsAll ¶
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 ¶
CountBy gives the number elements of IntList that return true for the predicate p.
func (IntList) DistinctBy ¶
DistinctBy returns a new IntList whose elements are unique, where equality is defined by the equal function.
func (IntList) DoReverse ¶
DoReverse alters a IntList with all elements in the reverse order. Unlike Reverse, it does not allocate new memory.
The list is modified and the modified list is returned.
func (IntList) DoShuffle ¶
DoShuffle returns a shuffled IntList, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (IntList) Drop ¶
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.
The original list is not modified.
func (IntList) DropLast ¶
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.
The original list is not modified.
func (IntList) DropWhile ¶
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.
The original list is not modified.
func (IntList) Equals ¶
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal.
func (IntList) Exists ¶
Exists verifies that one or more elements of IntList return true for the predicate p.
func (IntList) Filter ¶
Filter returns a new IntList whose elements return true for predicate p.
The original list is not modified.
func (IntList) Find ¶
Find returns the first int that returns true for predicate p. False is returned if none match.
func (IntList) FlatMap ¶
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. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntList) FlatMapToString ¶ added in v0.3.0
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. The list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntList) Fold ¶ added in v0.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (IntList) Forall ¶
Forall verifies that all elements of IntList return true for the predicate p.
func (IntList) Foreach ¶
Foreach iterates over IntList and executes function f against each element.
func (IntList) Get ¶
Get gets the specified element in the list. Panics if the index is out of range or the list is nil. The simple list is a dressed-up slice and normal slice operations will also work.
func (IntList) GobDecode ¶
GobDecode implements 'gob' decoding for this list type. You must register int with the 'gob' package before this method is used.
func (IntList) GobEncode ¶
GobEncode implements 'gob' encoding for this list type. You must register int with the 'gob' package before this method is used.
func (IntList) Head ¶
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 ¶
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (IntList) IndexWhere ¶
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (IntList) IndexWhere2 ¶
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 ¶
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) IsSequence ¶
IsSequence returns true for lists and queues.
func (IntList) Last ¶
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 ¶
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (IntList) LastIndexWhere2 ¶
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 ¶
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (IntList) Len ¶
Len returns the number of items in the list - an alias of Size(). This is one of the three methods in the standard sort.Interface.
func (IntList) Map ¶
Map returns a new IntList by transforming every element with function f. The resulting list is the same size as the original list. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntList) MapToString ¶ added in v0.3.0
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the list. The list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntList) Max ¶
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (IntList) MaxBy ¶
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 ¶
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (IntList) MinBy ¶
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 ¶
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (IntList) MkString3 ¶
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (IntList) Partition ¶
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.
The original list is not modified.
func (IntList) Reverse ¶
Reverse returns a copy of IntList with all elements in the reverse order.
The original list is not modified.
func (IntList) Send ¶
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed. The channel will be closed when all the elements have been sent.
func (IntList) Shuffle ¶
Shuffle returns a shuffled copy of IntList, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (IntList) SortBy ¶
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (IntList) Sorted ¶
Sorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (IntList) StableSortBy ¶
StableSortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned. The algorithm keeps the original order of equal elements.
func (IntList) StableSorted ¶
StableSorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (IntList) String ¶
String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.
func (IntList) StringList ¶
StringList gets a list of strings that depicts all the elements.
func (IntList) Swap ¶
Swap exchanges two elements, which is necessary during sorting etc. This is one of the three methods in the standard sort.Interface.
func (IntList) Tail ¶
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 ¶
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 ¶
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.
The original list is not modified.
func (IntList) TakeWhile ¶
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.
The original list is not modified.
func (IntList) ToInterfaceSlice ¶
func (list IntList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (IntList) ToList ¶
ToList returns the elements of the list as a list, which is an identity operation in this case.
type IntMkStringer ¶
type IntMkStringer interface { // String implements the Stringer interface to render the collection 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 // StringList gets a collection of strings that depicts all the elements. StringList() []string }
IntMkStringer defines an interface for stringer methods on int collections.
type IntQueue ¶ added in v0.9.0
type IntQueue struct {
// contains filtered or unexported fields
}
IntQueue is a ring buffer containing a slice of type int. It is optimised for FIFO operations.
func BuildIntQueueFromChan ¶ added in v0.9.0
BuildIntQueueFromChan constructs a new IntQueue from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func NewIntQueue ¶ added in v0.9.0
NewIntQueue returns a new queue of int. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue.
func NewIntSortedQueue ¶ added in v0.9.0
NewIntSortedQueue returns a new queue of int. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue. If the 'less' comparison function is not nil, elements can be easily sorted.
func (*IntQueue) Clone ¶ added in v0.9.0
Clone returns a shallow copy of the queue. It does not clone the underlying elements.
func (*IntQueue) Contains ¶ added in v0.9.0
Contains determines whether a given item is already in the queue, returning true if so.
func (*IntQueue) ContainsAll ¶ added in v0.9.0
ContainsAll determines whether the given items are all in the queue, returning true if so. This is potentially a slow method and should only be used rarely.
func (*IntQueue) CountBy ¶ added in v0.9.0
CountBy gives the number elements of IntQueue that return true for the predicate p.
func (*IntQueue) DoKeepWhere ¶ added in v0.9.0
DoKeepWhere modifies a IntQueue by retaining only those elements that match the predicate p. This is very similar to Filter but alters the queue in place.
The queue is modified and the modified queue is returned.
func (*IntQueue) Equals ¶ added in v0.9.0
Equals determines if two queues are equal to each other. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal. Nil queues are considered to be empty.
func (*IntQueue) Exists ¶ added in v0.9.0
Exists verifies that one or more elements of IntQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*IntQueue) Filter ¶ added in v0.9.0
Filter returns a new IntQueue whose elements return true for predicate p.
The original queue is not modified. See also DoKeepWhere (which does modify the original queue).
func (*IntQueue) Find ¶ added in v0.9.0
Find returns the first int that returns true for predicate p. False is returned if none match.
func (*IntQueue) FlatMap ¶ added in v0.9.0
FlatMap returns a new IntQueue by transforming every element with function f that returns zero or more items in a slice. The resulting queue may have a different size to the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*IntQueue) FlatMapToString ¶ added in v0.9.0
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 queue. The queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*IntQueue) Fold ¶ added in v0.9.0
Fold aggregates all the values in the queue using a supplied function, starting from some initial value.
func (*IntQueue) Forall ¶ added in v0.9.0
Forall verifies that all elements of IntQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*IntQueue) Foreach ¶ added in v0.9.0
Foreach iterates over IntQueue and executes function f against each element. The function can safely alter the values via side-effects.
func (*IntQueue) Get ¶ added in v0.9.0
Get gets the specified element in the queue. Panics if the index is out of range or the queue is nil.
func (*IntQueue) Head ¶ added in v0.9.0
Head gets the first element in the queue. Head is the opposite of Last. Panics if queue is empty or nil.
func (*IntQueue) HeadOption ¶ added in v0.9.0
HeadOption returns the oldest item in the queue without removing it. If the queue is nil or empty, it returns the zero value instead.
func (*IntQueue) IsOverwriting ¶ added in v0.9.0
IsOverwriting returns true if the queue is overwriting, false if refusing.
func (*IntQueue) IsSequence ¶ added in v0.9.0
IsSequence returns true for ordered lists and queues.
func (*IntQueue) Last ¶ added in v0.9.0
Last gets the the newest item in the queue (i.e. last element pushed) without removing it. Last is the opposite of Head. Panics if queue is empty or nil.
func (*IntQueue) LastOption ¶ added in v0.9.0
LastOption returns the newest item in the queue without removing it. If the queue is nil empty, it returns the zero value instead.
func (*IntQueue) Len ¶ added in v0.9.0
Len gets the current length of this queue. This is an alias for Size.
func (*IntQueue) Less ¶ added in v0.9.0
Less reports whether the element with index i should sort before the element with index j. The queue must have been created with a non-nil 'less' comparison function and it must not be empty.
func (*IntQueue) Map ¶ added in v0.9.0
Map returns a new IntQueue by transforming every element with function f. The resulting queue is the same size as the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*IntQueue) MapToString ¶ added in v0.9.0
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the queue. The queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntQueue) MarshalJSON ¶ added in v0.9.0
MarshalJSON implements JSON encoding for this queue type.
func (*IntQueue) Max ¶ added in v0.9.0
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (*IntQueue) MaxBy ¶ added in v0.9.0
MaxBy returns an element of IntQueue 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 (*IntQueue) Min ¶ added in v0.9.0
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (*IntQueue) MinBy ¶ added in v0.9.0
MinBy returns an element of IntQueue 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 (*IntQueue) MkString ¶ added in v0.9.0
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*IntQueue) MkString3 ¶ added in v0.9.0
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*IntQueue) Offer ¶ added in v0.9.0
Offer appends as many items to the end of the queue as it can. If the queue is already full, what happens depends on whether the queue is configured to overwrite. If it is, the oldest items will be overwritten. Otherwise, it will be filled to capacity and any unwritten items are returned.
If the capacity is too small for the number of items, the excess items are returned. The queue capacity is never altered.
func (*IntQueue) Partition ¶ added in v0.9.0
Partition returns two new IntQueues 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 queue.
The original queue is not modified
func (*IntQueue) Pop ¶ added in v0.9.0
Pop removes and returns the oldest items from the queue. If the queue is empty, it returns a nil slice. If n is larger than the current queue length, it returns all the available elements, so in this case the returned slice will be shorter than n.
func (*IntQueue) Pop1 ¶ added in v0.9.0
Pop1 removes and returns the oldest item from the queue. If the queue is empty, it returns the zero value instead. The boolean is true only if the element was available.
func (*IntQueue) Push ¶ added in v0.9.0
Push appends items to the end of the queue. If the queue does not have enough space, more will be allocated: how this happens depends on the overwriting mode.
When overwriting, the oldest items are overwritten with the new data; it expands the queue only if there is still not enough space.
Otherwise, the queue might be reallocated if necessary, ensuring that all the data is pushed without any older items being affected.
The modified queue is returned.
func (*IntQueue) Reallocate ¶ added in v0.9.0
Reallocate adjusts the allocated capacity of the queue and allows the overwriting behaviour to be changed.
If the new queue capacity is different to the current capacity, the queue is re-allocated to the new capacity. If this is less than the current number of elements, the oldest items in the queue are discarded so that the remaining data can fit in the new space available.
If the new queue capacity is the same as the current capacity, the queue is not altered except for adopting the new overwrite flag's value. Therefore this is the means to change the overwriting behaviour.
Reallocate adjusts the storage space but does not clone the underlying elements.
The queue must not be nil.
func (*IntQueue) Send ¶ added in v0.9.0
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 (*IntQueue) Size ¶ added in v0.9.0
Size gets the number of elements currently in this queue. This is an alias for Len.
func (*IntQueue) Sort ¶ added in v0.9.0
func (queue *IntQueue) Sort()
Sort sorts the queue using the 'less' comparison function, which must not be nil. This function will panic if the collection was created with a nil 'less' function (see NewIntSortedQueue).
func (*IntQueue) StableSort ¶ added in v0.9.0
func (queue *IntQueue) StableSort()
StableSort sorts the queue using the 'less' comparison function, which must not be nil. The result is stable so that repeated calls will not arbitrarily swap equal items. This function will panic if the collection was created with a nil 'less' function (see NewIntSortedQueue).
func (*IntQueue) String ¶ added in v0.9.0
String implements the Stringer interface to render the queue as a comma-separated string enclosed in square brackets.
func (*IntQueue) StringList ¶ added in v0.9.0
StringList gets a list of strings that depicts all the elements.
func (*IntQueue) Swap ¶ added in v0.9.0
Swap swaps the elements with indexes i and j. The queue must not be empty.
func (*IntQueue) ToInterfaceSlice ¶ added in v0.9.0
func (queue *IntQueue) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the queue as a slice of arbitrary type. The queue is not altered.
func (*IntQueue) ToSlice ¶ added in v0.9.0
ToSlice returns the elements of the queue as a slice. The queue is not altered.
func (*IntQueue) UnmarshalJSON ¶ added in v0.9.0
UnmarshalJSON implements JSON decoding for this queue type.
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 ¶
type IntSet map[int]struct{}
IntSet is the primary type that represents a set
func BuildIntSetFromChan ¶
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 ¶
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 (IntSet) Append ¶
Append inserts more items into a clone of the set. It returns the augmented set. The original set is unmodified.
func (IntSet) Cardinality ¶
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*IntSet) Clear ¶
func (set *IntSet) Clear()
Clear the entire set. Aterwards, it will be an empty set.
func (IntSet) Clone ¶
Clone returns a shallow copy of the set. It does not clone the underlying elements.
func (IntSet) Contains ¶
Contains determines whether a given item is already in the set, returning true if so.
func (IntSet) ContainsAll ¶
ContainsAll determines whether a given item is already in the set, returning true if so.
func (IntSet) CountBy ¶
CountBy gives the number elements of IntSet that return true for the predicate p.
func (IntSet) Difference ¶
Difference returns a new set with items in the current set but not in the other set
func (IntSet) Equals ¶
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 ¶
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 ¶
Filter returns a new IntSet whose elements return true for the predicate p.
The original set is not modified
func (IntSet) Find ¶
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 ¶
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. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntSet) FlatMapToString ¶
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. The set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntSet) Fold ¶ added in v0.9.0
Fold aggregates all the values in the set using a supplied function, starting from some initial value.
func (IntSet) Forall ¶
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 ¶
Foreach iterates over the set and executes the function f against each element.
func (IntSet) IsSequence ¶
IsSequence returns true for lists and queues.
func (IntSet) IsSubset ¶
IsSubset determines whether every item in the other set is in this set, returning true if so.
func (IntSet) IsSuperset ¶
IsSuperset determines whether every item of this set is in the other set, returning true if so.
func (IntSet) Map ¶
Map returns a new IntSet by transforming every element with a function f. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntSet) MapToString ¶
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set. The set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntSet) MarshalJSON ¶
MarshalJSON implements JSON encoding for this set type.
func (IntSet) Max ¶
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (IntSet) MaxBy ¶
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 ¶
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (IntSet) MinBy ¶
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 ¶
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (IntSet) MkString3 ¶
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (IntSet) Partition ¶
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 original set is not modified
func (IntSet) Send ¶
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed
func (IntSet) Size ¶
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (IntSet) String ¶
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (IntSet) StringList ¶
StringList gets a list of strings that depicts all the elements.
func (IntSet) StringMap ¶
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) SymmetricDifference ¶
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (IntSet) ToInterfaceSlice ¶
func (set IntSet) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.
func (IntSet) ToList ¶
ToList returns the elements of the set as a list. The returned list is a shallow copy; the set is not altered.
func (IntSet) UnmarshalJSON ¶
UnmarshalJSON implements JSON decoding for this set type.
type IntSizer ¶
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 collection - an alias of Len(). Size() int }
IntSizer defines an interface for sizing methods on int collections.
type IntStringMap ¶
IntStringMap is the primary type that represents a map
func NewIntStringMap ¶
func NewIntStringMap(kv ...IntStringTuple) IntStringMap
NewIntStringMap creates and returns a reference to a map, optionally containing some items.
func NewIntStringMap1 ¶
func NewIntStringMap1(k int, v string) IntStringMap
NewIntStringMap1 creates and returns a reference to a map containing one item.
func (IntStringMap) Clone ¶
func (mm IntStringMap) Clone() IntStringMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (IntStringMap) ContainsAllKeys ¶
func (mm IntStringMap) ContainsAllKeys(kk ...int) bool
ContainsAllKeys determines if the given items are all in the map.
func (IntStringMap) ContainsKey ¶
func (mm IntStringMap) ContainsKey(k int) bool
ContainsKey determines if a given item is already in the map.
func (IntStringMap) DropWhere ¶
func (mm IntStringMap) DropWhere(fn func(int, string) bool) IntStringTuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
func (IntStringMap) Equals ¶
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 ¶
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 ¶
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. The original map is not modified.
func (IntStringMap) Find ¶
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. The original map is not modified.
func (IntStringMap) FlatMap ¶
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntStringMap) Forall ¶
func (mm IntStringMap) Forall(p 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 ¶
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 ¶
func (mm IntStringMap) Get(k int) (string, bool)
Get returns one of the items in the map, if present.
func (IntStringMap) IsEmpty ¶
func (mm IntStringMap) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (IntStringMap) Keys ¶
func (mm IntStringMap) Keys() IntList
Keys returns the keys of the current map as a slice.
func (IntStringMap) Map ¶
func (mm IntStringMap) Map(f func(int, string) (int, string)) IntStringMap
Map returns a new StringMap by transforming every element with the function f. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (IntStringMap) MkString ¶
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 ¶
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 IntList) IntStringTuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (IntStringMap) Partition ¶
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. The original map is not modified.
func (IntStringMap) Pop ¶
func (mm IntStringMap) Pop(k int) (string, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (IntStringMap) Put ¶
func (mm IntStringMap) Put(k int, v string) bool
Put adds an item to the current map, replacing any prior value.
func (IntStringMap) Remove ¶
func (mm IntStringMap) Remove(k int)
Remove a single item from the map.
func (IntStringMap) Size ¶
func (mm IntStringMap) Size() int
Size returns how many items are currently in the map. This is a synonym for Len.
func (IntStringMap) String ¶
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 ¶
func (mm IntStringMap) ToSlice() IntStringTuples
ToSlice returns the key/value pairs as a slice.
func (IntStringMap) Values ¶
func (mm IntStringMap) Values() StringList
Values returns the values of the current map as a slice.
type IntStringTuple ¶
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 ¶
type IntStringTuples []IntStringTuple
IntStringTuples can be used as a builder for unmodifiable maps.
func IntStringZip ¶
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 ¶
func (ts IntStringTuples) Append1(k int, v string) IntStringTuples
Append1 adds one item.
func (IntStringTuples) Append2 ¶
func (ts IntStringTuples) Append2(k1 int, v1 string, k2 int, v2 string) IntStringTuples
Append2 adds two items.
func (IntStringTuples) Append3 ¶
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 ¶
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 map[string]interface{}
StringAnyMap is the primary type that represents a 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) Clear ¶ added in v0.4.0
func (mm *StringAnyMap) Clear()
Clear clears the entire map.
func (StringAnyMap) Clone ¶ added in v0.4.0
func (mm StringAnyMap) Clone() StringAnyMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
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) DropWhere ¶ added in v0.4.0
func (mm StringAnyMap) DropWhere(fn func(string, interface{}) bool) StringAnyTuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
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. The original map is not modified.
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. The original map is not modified.
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringAnyMap) Forall ¶ added in v0.4.0
func (mm StringAnyMap) Forall(p 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) 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() 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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringAnyMap) 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 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. The original map is not modified.
func (StringAnyMap) Pop ¶ added in v0.4.0
func (mm StringAnyMap) Pop(k string) (interface{}, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (StringAnyMap) Put ¶ added in v0.4.0
func (mm StringAnyMap) Put(k string, v interface{}) bool
Put adds an item to the current map, replacing any prior value.
func (StringAnyMap) Remove ¶ added in v0.4.0
func (mm StringAnyMap) Remove(k string)
Remove a single item from the 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) Values ¶ added in v0.4.0
func (mm StringAnyMap) Values() 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 ¶
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) // 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 ¶
StringIntMap is the primary type that represents a map
func NewStringIntMap ¶
func NewStringIntMap(kv ...StringIntTuple) StringIntMap
NewStringIntMap creates and returns a reference to a map, optionally containing some items.
func NewStringIntMap1 ¶
func NewStringIntMap1(k string, v int) StringIntMap
NewStringIntMap1 creates and returns a reference to a map containing one item.
func (StringIntMap) Clone ¶
func (mm StringIntMap) Clone() StringIntMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (StringIntMap) ContainsAllKeys ¶
func (mm StringIntMap) ContainsAllKeys(kk ...string) bool
ContainsAllKeys determines if the given items are all in the map.
func (StringIntMap) ContainsKey ¶
func (mm StringIntMap) ContainsKey(k string) bool
ContainsKey determines if a given item is already in the map.
func (StringIntMap) DropWhere ¶
func (mm StringIntMap) DropWhere(fn func(string, int) bool) StringIntTuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
func (StringIntMap) Equals ¶
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 ¶
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 ¶
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. The original map is not modified.
func (StringIntMap) Find ¶
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. The original map is not modified.
func (StringIntMap) FlatMap ¶
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringIntMap) Forall ¶
func (mm StringIntMap) Forall(p 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 ¶
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 ¶
func (mm StringIntMap) Get(k string) (int, bool)
Get returns one of the items in the map, if present.
func (StringIntMap) IsEmpty ¶
func (mm StringIntMap) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (StringIntMap) Keys ¶
func (mm StringIntMap) Keys() StringList
Keys returns the keys of the current map as a slice.
func (StringIntMap) Map ¶
func (mm StringIntMap) Map(f func(string, int) (string, int)) StringIntMap
Map returns a new IntMap by transforming every element with the function f. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringIntMap) MkString ¶
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 ¶
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 StringList) StringIntTuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (StringIntMap) Partition ¶
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. The original map is not modified.
func (StringIntMap) Pop ¶
func (mm StringIntMap) Pop(k string) (int, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (StringIntMap) Put ¶
func (mm StringIntMap) Put(k string, v int) bool
Put adds an item to the current map, replacing any prior value.
func (StringIntMap) Remove ¶
func (mm StringIntMap) Remove(k string)
Remove a single item from the map.
func (StringIntMap) Size ¶
func (mm StringIntMap) Size() int
Size returns how many items are currently in the map. This is a synonym for Len.
func (StringIntMap) String ¶
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 ¶
func (mm StringIntMap) ToSlice() StringIntTuples
ToSlice returns the key/value pairs as a slice.
func (StringIntMap) Values ¶
func (mm StringIntMap) Values() IntList
Values returns the values of the current map as a slice.
type StringIntTuple ¶
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 ¶
type StringIntTuples []StringIntTuple
StringIntTuples can be used as a builder for unmodifiable maps.
func StringIntZip ¶
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 ¶
func (ts StringIntTuples) Append1(k string, v int) StringIntTuples
Append1 adds one item.
func (StringIntTuples) Append2 ¶
func (ts StringIntTuples) Append2(k1 string, v1 int, k2 string, v2 int) StringIntTuples
Append2 adds two items.
func (StringIntTuples) Append3 ¶
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 ¶
func (ts StringIntTuples) Values(values ...int) StringIntTuples
Values sets the values in a tuple slice. Use this with StringIntZip.
type StringList ¶
type StringList []string
StringList is a slice of type string. Use it where you would use []string. To add items to the list, simply use the normal built-in append function.
List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq
func BuildStringListFromChan ¶
func BuildStringListFromChan(source <-chan string) StringList
BuildStringListFromChan constructs a new StringList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertStringList ¶
func ConvertStringList(values ...interface{}) (StringList, bool)
ConvertStringList constructs a new list containing the supplied values, if any. The returned boolean will be false if any of the values could not be converted correctly. The returned list will contain all the values that were correctly converted.
func MakeStringList ¶
func MakeStringList(length, capacity int) StringList
MakeStringList makes an empty list with both length and capacity initialised.
func NewStringList ¶
func NewStringList(values ...string) StringList
NewStringList constructs a new list containing the supplied values, if any.
func (StringList) Clone ¶
func (list StringList) Clone() StringList
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (StringList) Contains ¶
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 ¶
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 ¶
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 ¶
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) DoReverse ¶
func (list StringList) DoReverse() StringList
DoReverse alters a StringList with all elements in the reverse order. Unlike Reverse, it does not allocate new memory.
The list is modified and the modified list is returned.
func (StringList) DoShuffle ¶
func (list StringList) DoShuffle() StringList
DoShuffle returns a shuffled StringList, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (StringList) Drop ¶
func (list StringList) Drop(n int) StringList
Drop returns a slice of StringList without the leading n elements of the source list. If n is greater than or equal to the size of the list, an empty list is returned.
The original list is not modified.
func (StringList) DropLast ¶
func (list StringList) DropLast(n int) StringList
DropLast returns a slice of StringList without the trailing n elements of the source list. If n is greater than or equal to the size of the list, an empty list is returned.
The original list is not modified.
func (StringList) DropWhile ¶
func (list StringList) DropWhile(p func(string) bool) StringList
DropWhile returns a new StringList containing the trailing elements of the source list. Whilst the predicate p returns true, elements are excluded from the result. Once predicate p returns false, all remaining elements are added.
The original list is not modified.
func (StringList) Equals ¶
func (list StringList) Equals(other StringList) bool
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal.
func (StringList) Exists ¶
func (list StringList) Exists(p func(string) bool) bool
Exists verifies that one or more elements of StringList return true for the predicate p.
func (StringList) Filter ¶
func (list StringList) Filter(p func(string) bool) StringList
Filter returns a new StringList whose elements return true for predicate p.
The original list is not modified.
func (StringList) Find ¶
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 ¶
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. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringList) 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. The list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringList) Fold ¶ added in v0.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (StringList) Forall ¶
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 ¶
func (list StringList) Foreach(f func(string))
Foreach iterates over StringList and executes function f against each element.
func (StringList) Get ¶
func (list StringList) Get(i int) string
Get gets the specified element in the list. Panics if the index is out of range or the list is nil. The simple list is a dressed-up slice and normal slice operations will also work.
func (StringList) GobDecode ¶
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 ¶
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 ¶
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 ¶
func (list StringList) HeadOption() (string, bool)
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (StringList) IndexWhere ¶
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 ¶
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 ¶
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 ¶
func (list StringList) IsEmpty() bool
IsEmpty tests whether StringList is empty.
func (StringList) IsSequence ¶
func (list StringList) IsSequence() bool
IsSequence returns true for lists and queues.
func (StringList) IsSet ¶
func (list StringList) IsSet() bool
IsSet returns false for lists or queues.
func (StringList) Last ¶
func (list StringList) Last() string
Last gets the last element in the list. Init plus Last include the whole list. Last is the opposite of Head. Panics if list is empty or nil.
func (StringList) LastIndexWhere ¶
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 ¶
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 ¶
func (list StringList) LastOption() (string, bool)
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (StringList) Len ¶
func (list StringList) Len() int
Len returns the number of items in the list - an alias of Size(). This is one of the three methods in the standard sort.Interface.
func (StringList) Map ¶
func (list StringList) Map(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. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringList) 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. The list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringList) MaxBy ¶
func (list StringList) MaxBy(less func(string, string) bool) string
MaxBy returns an element of StringList containing the maximum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally maximal, the first such element is returned. Panics if there are no elements.
func (StringList) MinBy ¶
func (list StringList) MinBy(less func(string, string) bool) string
MinBy returns an element of StringList containing the minimum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally minimal, the first such element is returned. Panics if there are no elements.
func (StringList) MkString ¶
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 ¶
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 ¶
func (list StringList) NonEmpty() bool
NonEmpty tests whether StringList is empty.
func (StringList) Partition ¶
func (list StringList) Partition(p func(string) bool) (StringList, StringList)
Partition returns two new StringLists whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list.
The original list is not modified.
func (StringList) Reverse ¶
func (list StringList) Reverse() StringList
Reverse returns a copy of StringList with all elements in the reverse order.
The original list is not modified.
func (StringList) Send ¶
func (list StringList) Send() <-chan string
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed. The channel will be closed when all the elements have been sent.
func (StringList) Shuffle ¶
func (list StringList) Shuffle() StringList
Shuffle returns a shuffled copy of StringList, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (StringList) Size ¶
func (list StringList) Size() int
Size returns the number of items in the list - an alias of Len().
func (StringList) SortBy ¶
func (list StringList) SortBy(less func(i, j string) bool) StringList
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (StringList) Sorted ¶ added in v0.5.0
func (list StringList) Sorted() StringList
Sorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (StringList) StableSortBy ¶
func (list StringList) StableSortBy(less func(i, j string) bool) StringList
StableSortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned. The algorithm keeps the original order of equal elements.
func (StringList) String ¶
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 ¶
func (list StringList) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (StringList) Swap ¶
func (list StringList) Swap(i, j int)
Swap exchanges two elements, which is necessary during sorting etc. This is one of the three methods in the standard sort.Interface.
func (StringList) Tail ¶
func (list StringList) Tail() StringList
Tail gets everything except the head. Head plus Tail include the whole list. Tail is the opposite of Init. Panics if list is empty or nil.
func (StringList) Take ¶
func (list StringList) Take(n int) StringList
Take returns a slice of StringList containing the leading n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.
func (StringList) TakeLast ¶
func (list StringList) TakeLast(n int) StringList
TakeLast returns a slice of StringList containing the trailing n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.
The original list is not modified.
func (StringList) TakeWhile ¶
func (list StringList) TakeWhile(p func(string) bool) StringList
TakeWhile returns a new StringList containing the leading elements of the source list. Whilst the predicate p returns true, elements are added to the result. Once predicate p returns false, all remaining elements are excluded.
The original list is not modified.
func (StringList) ToInterfaceSlice ¶
func (list StringList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (StringList) ToList ¶
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 ¶
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 ¶
func (list StringList) ToSlice() []string
ToSlice returns the elements of the list as a slice, which is an identity operation in this case, because the simple list is merely a dressed-up slice.
type StringMkStringer ¶
type StringMkStringer interface { // String implements the Stringer interface to render the collection 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 // StringList gets a collection of strings that depicts all the elements. StringList() []string }
StringMkStringer defines an interface for stringer methods on string collections.
type StringQueue ¶ added in v0.9.0
type StringQueue struct {
// contains filtered or unexported fields
}
StringQueue is a ring buffer containing a slice of type string. It is optimised for FIFO operations.
func BuildStringQueueFromChan ¶ added in v0.9.0
func BuildStringQueueFromChan(source <-chan string) *StringQueue
BuildStringQueueFromChan constructs a new StringQueue from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func NewStringQueue ¶ added in v0.9.0
func NewStringQueue(capacity int, overwrite bool) *StringQueue
NewStringQueue returns a new queue of string. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue.
func NewStringSortedQueue ¶ added in v0.9.0
func NewStringSortedQueue(capacity int, overwrite bool, less func(i, j string) bool) *StringQueue
NewStringSortedQueue returns a new queue of string. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue. If the 'less' comparison function is not nil, elements can be easily sorted.
func (*StringQueue) Add ¶ added in v0.9.0
func (queue *StringQueue) Add(more ...string)
Add adds items to the queue. This is a synonym for Push.
func (*StringQueue) Cap ¶ added in v0.9.0
func (queue *StringQueue) Cap() int
Cap gets the capacity of this queue.
func (*StringQueue) Clear ¶ added in v0.9.0
func (queue *StringQueue) Clear()
Clear the entire queue.
func (*StringQueue) Clone ¶ added in v0.9.0
func (queue *StringQueue) Clone() *StringQueue
Clone returns a shallow copy of the queue. It does not clone the underlying elements.
func (*StringQueue) Contains ¶ added in v0.9.0
func (queue *StringQueue) Contains(v string) bool
Contains determines whether a given item is already in the queue, returning true if so.
func (*StringQueue) ContainsAll ¶ added in v0.9.0
func (queue *StringQueue) ContainsAll(i ...string) bool
ContainsAll determines whether the given items are all in the queue, returning true if so. This is potentially a slow method and should only be used rarely.
func (*StringQueue) CountBy ¶ added in v0.9.0
func (queue *StringQueue) CountBy(p func(string) bool) (result int)
CountBy gives the number elements of StringQueue that return true for the predicate p.
func (*StringQueue) DoKeepWhere ¶ added in v0.9.0
func (queue *StringQueue) DoKeepWhere(p func(string) bool) *StringQueue
DoKeepWhere modifies a StringQueue by retaining only those elements that match the predicate p. This is very similar to Filter but alters the queue in place.
The queue is modified and the modified queue is returned.
func (*StringQueue) Equals ¶ added in v0.9.0
func (queue *StringQueue) Equals(other *StringQueue) bool
Equals determines if two queues are equal to each other. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal. Nil queues are considered to be empty.
func (*StringQueue) Exists ¶ added in v0.9.0
func (queue *StringQueue) Exists(p func(string) bool) bool
Exists verifies that one or more elements of StringQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*StringQueue) Filter ¶ added in v0.9.0
func (queue *StringQueue) Filter(p func(string) bool) *StringQueue
Filter returns a new StringQueue whose elements return true for predicate p.
The original queue is not modified. See also DoKeepWhere (which does modify the original queue).
func (*StringQueue) Find ¶ added in v0.9.0
func (queue *StringQueue) 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 (*StringQueue) FlatMap ¶ added in v0.9.0
func (queue *StringQueue) FlatMap(f func(string) []string) *StringQueue
FlatMap returns a new StringQueue by transforming every element with function f that returns zero or more items in a slice. The resulting queue may have a different size to the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*StringQueue) FlatMapToInt ¶ added in v0.9.0
func (queue *StringQueue) 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 queue. The queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*StringQueue) Fold ¶ added in v0.9.0
Fold aggregates all the values in the queue using a supplied function, starting from some initial value.
func (*StringQueue) Forall ¶ added in v0.9.0
func (queue *StringQueue) Forall(p func(string) bool) bool
Forall verifies that all elements of StringQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*StringQueue) Foreach ¶ added in v0.9.0
func (queue *StringQueue) Foreach(f func(string))
Foreach iterates over StringQueue and executes function f against each element. The function can safely alter the values via side-effects.
func (*StringQueue) Get ¶ added in v0.9.0
func (queue *StringQueue) Get(i int) string
Get gets the specified element in the queue. Panics if the index is out of range or the queue is nil.
func (*StringQueue) Head ¶ added in v0.9.0
func (queue *StringQueue) Head() string
Head gets the first element in the queue. Head is the opposite of Last. Panics if queue is empty or nil.
func (*StringQueue) HeadOption ¶ added in v0.9.0
func (queue *StringQueue) HeadOption() (string, bool)
HeadOption returns the oldest item in the queue without removing it. If the queue is nil or empty, it returns the zero value instead.
func (*StringQueue) IsEmpty ¶ added in v0.9.0
func (queue *StringQueue) IsEmpty() bool
IsEmpty returns true if the queue is empty.
func (*StringQueue) IsFull ¶ added in v0.9.0
func (queue *StringQueue) IsFull() bool
IsFull returns true if the queue is full.
func (*StringQueue) IsOverwriting ¶ added in v0.9.0
func (queue *StringQueue) IsOverwriting() bool
IsOverwriting returns true if the queue is overwriting, false if refusing.
func (*StringQueue) IsSequence ¶ added in v0.9.0
func (queue *StringQueue) IsSequence() bool
IsSequence returns true for ordered lists and queues.
func (*StringQueue) IsSet ¶ added in v0.9.0
func (queue *StringQueue) IsSet() bool
IsSet returns false for lists or queues.
func (*StringQueue) Last ¶ added in v0.9.0
func (queue *StringQueue) Last() string
Last gets the the newest item in the queue (i.e. last element pushed) without removing it. Last is the opposite of Head. Panics if queue is empty or nil.
func (*StringQueue) LastOption ¶ added in v0.9.0
func (queue *StringQueue) LastOption() (string, bool)
LastOption returns the newest item in the queue without removing it. If the queue is nil empty, it returns the zero value instead.
func (*StringQueue) Len ¶ added in v0.9.0
func (queue *StringQueue) Len() int
Len gets the current length of this queue. This is an alias for Size.
func (*StringQueue) Less ¶ added in v0.9.0
func (queue *StringQueue) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j. The queue must have been created with a non-nil 'less' comparison function and it must not be empty.
func (*StringQueue) Map ¶ added in v0.9.0
func (queue *StringQueue) Map(f func(string) string) *StringQueue
Map returns a new StringQueue by transforming every element with function f. The resulting queue is the same size as the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*StringQueue) MapToInt ¶ added in v0.9.0
func (queue *StringQueue) 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 queue. The queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringQueue) MarshalJSON ¶ added in v0.9.0
func (queue StringQueue) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this queue type.
func (*StringQueue) MaxBy ¶ added in v0.9.0
func (queue *StringQueue) MaxBy(less func(string, string) bool) string
MaxBy returns an element of StringQueue 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 (*StringQueue) MinBy ¶ added in v0.9.0
func (queue *StringQueue) MinBy(less func(string, string) bool) string
MinBy returns an element of StringQueue 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 (*StringQueue) MkString ¶ added in v0.9.0
func (queue *StringQueue) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*StringQueue) MkString3 ¶ added in v0.9.0
func (queue *StringQueue) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*StringQueue) NonEmpty ¶ added in v0.9.0
func (queue *StringQueue) NonEmpty() bool
NonEmpty returns true if the queue is not empty.
func (*StringQueue) Offer ¶ added in v0.9.0
func (queue *StringQueue) Offer(items ...string) []string
Offer appends as many items to the end of the queue as it can. If the queue is already full, what happens depends on whether the queue is configured to overwrite. If it is, the oldest items will be overwritten. Otherwise, it will be filled to capacity and any unwritten items are returned.
If the capacity is too small for the number of items, the excess items are returned. The queue capacity is never altered.
func (*StringQueue) Partition ¶ added in v0.9.0
func (queue *StringQueue) Partition(p func(string) bool) (*StringQueue, *StringQueue)
Partition returns two new StringQueues 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 queue.
The original queue is not modified
func (*StringQueue) Pop ¶ added in v0.9.0
func (queue *StringQueue) Pop(n int) []string
Pop removes and returns the oldest items from the queue. If the queue is empty, it returns a nil slice. If n is larger than the current queue length, it returns all the available elements, so in this case the returned slice will be shorter than n.
func (*StringQueue) Pop1 ¶ added in v0.9.0
func (queue *StringQueue) Pop1() (string, bool)
Pop1 removes and returns the oldest item from the queue. If the queue is empty, it returns the zero value instead. The boolean is true only if the element was available.
func (*StringQueue) Push ¶ added in v0.9.0
func (queue *StringQueue) Push(items ...string) *StringQueue
Push appends items to the end of the queue. If the queue does not have enough space, more will be allocated: how this happens depends on the overwriting mode.
When overwriting, the oldest items are overwritten with the new data; it expands the queue only if there is still not enough space.
Otherwise, the queue might be reallocated if necessary, ensuring that all the data is pushed without any older items being affected.
The modified queue is returned.
func (*StringQueue) Reallocate ¶ added in v0.9.0
func (queue *StringQueue) Reallocate(capacity int, overwrite bool) *StringQueue
Reallocate adjusts the allocated capacity of the queue and allows the overwriting behaviour to be changed.
If the new queue capacity is different to the current capacity, the queue is re-allocated to the new capacity. If this is less than the current number of elements, the oldest items in the queue are discarded so that the remaining data can fit in the new space available.
If the new queue capacity is the same as the current capacity, the queue is not altered except for adopting the new overwrite flag's value. Therefore this is the means to change the overwriting behaviour.
Reallocate adjusts the storage space but does not clone the underlying elements.
The queue must not be nil.
func (*StringQueue) Send ¶ added in v0.9.0
func (queue *StringQueue) 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 (*StringQueue) Size ¶ added in v0.9.0
func (queue *StringQueue) Size() int
Size gets the number of elements currently in this queue. This is an alias for Len.
func (*StringQueue) Sort ¶ added in v0.9.0
func (queue *StringQueue) Sort()
Sort sorts the queue using the 'less' comparison function, which must not be nil. This function will panic if the collection was created with a nil 'less' function (see NewStringSortedQueue).
func (*StringQueue) Space ¶ added in v0.9.0
func (queue *StringQueue) Space() int
Space returns the space available in the queue.
func (*StringQueue) StableSort ¶ added in v0.9.0
func (queue *StringQueue) StableSort()
StableSort sorts the queue using the 'less' comparison function, which must not be nil. The result is stable so that repeated calls will not arbitrarily swap equal items. This function will panic if the collection was created with a nil 'less' function (see NewStringSortedQueue).
func (*StringQueue) String ¶ added in v0.9.0
func (queue *StringQueue) String() string
String implements the Stringer interface to render the queue as a comma-separated string enclosed in square brackets.
func (*StringQueue) StringList ¶ added in v0.9.0
func (queue *StringQueue) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (*StringQueue) Swap ¶ added in v0.9.0
func (queue *StringQueue) Swap(i, j int)
Swap swaps the elements with indexes i and j. The queue must not be empty.
func (*StringQueue) ToInterfaceSlice ¶ added in v0.9.0
func (queue *StringQueue) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the queue as a slice of arbitrary type. The queue is not altered.
func (*StringQueue) ToSlice ¶ added in v0.9.0
func (queue *StringQueue) ToSlice() []string
ToSlice returns the elements of the queue as a slice. The queue is not altered.
func (*StringQueue) UnmarshalJSON ¶ added in v0.9.0
func (queue *StringQueue) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this queue type.
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 ¶
type StringSet map[string]struct{}
StringSet is the primary type that represents a set
func BuildStringSetFromChan ¶
BuildStringSetFromChan constructs a new StringSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertStringSet ¶
ConvertStringSet constructs a new set containing the supplied values, if any. The returned boolean will be false if any of the values could not be converted correctly. The returned set will contain all the values that were correctly converted.
func NewStringSet ¶
NewStringSet creates and returns a reference to an empty set.
func (StringSet) Append ¶
Append inserts more items into a clone of the set. It returns the augmented set. The original set is unmodified.
func (StringSet) Cardinality ¶
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*StringSet) Clear ¶
func (set *StringSet) Clear()
Clear the entire set. Aterwards, it will be an empty set.
func (StringSet) Clone ¶
Clone returns a shallow copy of the set. It does not clone the underlying elements.
func (StringSet) Contains ¶
Contains determines whether a given item is already in the set, returning true if so.
func (StringSet) ContainsAll ¶
ContainsAll determines whether a given item is already in the set, returning true if so.
func (StringSet) CountBy ¶
CountBy gives the number elements of StringSet that return true for the predicate p.
func (StringSet) Difference ¶
Difference returns a new set with items in the current set but not in the other set
func (StringSet) Equals ¶
Equals determines 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 ¶
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 ¶
Filter returns a new StringSet whose elements return true for the predicate p.
The original set is not modified
func (StringSet) Find ¶
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 ¶
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. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringSet) FlatMapToInt ¶
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. The set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringSet) Fold ¶ added in v0.9.0
Fold aggregates all the values in the set using a supplied function, starting from some initial value.
func (StringSet) Forall ¶
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 ¶
Foreach iterates over the set and executes the function f against each element.
func (StringSet) IsSequence ¶
IsSequence returns true for lists and queues.
func (StringSet) IsSubset ¶
IsSubset determines whether every item in the other set is in this set, returning true if so.
func (StringSet) IsSuperset ¶
IsSuperset determines whether every item of this set is in the other set, returning true if so.
func (StringSet) Map ¶
Map returns a new StringSet by transforming every element with a function f. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringSet) MapToInt ¶
MapToInt returns a new []int by transforming every element with function f. The resulting slice is the same size as the set. The set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringSet) MarshalJSON ¶
MarshalJSON implements JSON encoding for this set type.
func (StringSet) MaxBy ¶
MaxBy returns an element of StringSet containing the maximum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally maximal, the first such element is returned. Panics if there are no elements.
func (StringSet) MinBy ¶
MinBy returns an element of StringSet containing the minimum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally minimal, the first such element is returned. Panics if there are no elements.
func (StringSet) MkString ¶
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (StringSet) MkString3 ¶
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (StringSet) Partition ¶
Partition returns two new StringSets whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't.
The original set is not modified
func (StringSet) Send ¶
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed
func (StringSet) Size ¶
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (StringSet) String ¶
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (StringSet) StringList ¶
StringList gets a list of strings that depicts all the elements.
func (StringSet) StringMap ¶
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 ¶
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (StringSet) ToInterfaceSlice ¶
func (set StringSet) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.
func (StringSet) ToList ¶
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) UnmarshalJSON ¶
UnmarshalJSON implements JSON decoding for this set type.
type StringSizer ¶
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 collection - an alias of Len(). Size() int }
StringSizer defines an interface for sizing methods on string collections.
type StringStringMap ¶
StringStringMap is the primary type that represents a map
func NewStringStringMap ¶
func NewStringStringMap(kv ...StringStringTuple) StringStringMap
NewStringStringMap creates and returns a reference to a map, optionally containing some items.
func NewStringStringMap1 ¶
func NewStringStringMap1(k string, v string) StringStringMap
NewStringStringMap1 creates and returns a reference to a map containing one item.
func (StringStringMap) Clone ¶
func (mm StringStringMap) Clone() StringStringMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (StringStringMap) ContainsAllKeys ¶
func (mm StringStringMap) ContainsAllKeys(kk ...string) bool
ContainsAllKeys determines if the given items are all in the map.
func (StringStringMap) ContainsKey ¶
func (mm StringStringMap) ContainsKey(k string) bool
ContainsKey determines if a given item is already in the map.
func (StringStringMap) DropWhere ¶
func (mm StringStringMap) DropWhere(fn func(string, string) bool) StringStringTuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
func (StringStringMap) Equals ¶
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 ¶
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 ¶
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. The original map is not modified.
func (StringStringMap) Find ¶
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. The original map is not modified.
func (StringStringMap) FlatMap ¶
func (mm StringStringMap) FlatMap(f func(string, string) []StringStringTuple) StringStringMap
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringStringMap) Forall ¶
func (mm StringStringMap) Forall(p 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 ¶
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 ¶
func (mm StringStringMap) Get(k string) (string, bool)
Get returns one of the items in the map, if present.
func (StringStringMap) IsEmpty ¶
func (mm StringStringMap) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (StringStringMap) Keys ¶
func (mm StringStringMap) Keys() StringList
Keys returns the keys of the current map as a slice.
func (StringStringMap) Map ¶
func (mm StringStringMap) Map(f func(string, string) (string, string)) StringStringMap
Map returns a new StringMap by transforming every element with the function f. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringStringMap) MkString ¶
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 ¶
func (mm StringStringMap) NonEmpty() bool
NonEmpty returns true if the map is not empty.
func (StringStringMap) OrderedSlice ¶ added in v0.6.0
func (mm StringStringMap) OrderedSlice(keys StringList) StringStringTuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (StringStringMap) Partition ¶
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. The original map is not modified.
func (StringStringMap) Pop ¶
func (mm StringStringMap) Pop(k string) (string, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (StringStringMap) Put ¶
func (mm StringStringMap) Put(k string, v string) bool
Put adds an item to the current map, replacing any prior value.
func (StringStringMap) Remove ¶
func (mm StringStringMap) Remove(k string)
Remove a single item from the map.
func (StringStringMap) Size ¶
func (mm StringStringMap) Size() int
Size returns how many items are currently in the map. This is a synonym for Len.
func (StringStringMap) String ¶
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 ¶
func (mm StringStringMap) ToSlice() StringStringTuples
ToSlice returns the key/value pairs as a slice.
func (StringStringMap) Values ¶
func (mm StringStringMap) Values() StringList
Values returns the values of the current map as a slice.
type StringStringTuple ¶
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 ¶
type StringStringTuples []StringStringTuple
StringStringTuples can be used as a builder for unmodifiable maps.
func StringStringZip ¶
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 ¶
func (ts StringStringTuples) Append1(k string, v string) StringStringTuples
Append1 adds one item.
func (StringStringTuples) Append2 ¶
func (ts StringStringTuples) Append2(k1 string, v1 string, k2 string, v2 string) StringStringTuples
Append2 adds two items.
func (StringStringTuples) Append3 ¶
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 ¶
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
StringUintMap is the primary type that represents a 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) Clear ¶ added in v0.3.0
func (mm *StringUintMap) Clear()
Clear clears the entire map.
func (StringUintMap) Clone ¶ added in v0.3.0
func (mm StringUintMap) Clone() StringUintMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
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) DropWhere ¶ added in v0.3.0
func (mm StringUintMap) DropWhere(fn func(string, uint) bool) StringUintTuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
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. The original map is not modified.
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. The original map is not modified.
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (StringUintMap) Forall ¶ added in v0.3.0
func (mm StringUintMap) Forall(p 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) 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() 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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (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 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. The original map is not modified.
func (StringUintMap) Pop ¶ added in v0.3.0
func (mm StringUintMap) Pop(k string) (uint, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (StringUintMap) Put ¶ added in v0.3.0
func (mm StringUintMap) Put(k string, v uint) bool
Put adds an item to the current map, replacing any prior value.
func (StringUintMap) Remove ¶ added in v0.3.0
func (mm StringUintMap) Remove(k string)
Remove a single item from the 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) Values ¶ added in v0.3.0
func (mm StringUintMap) Values() UintList
Values returns the values of the current map as a slice.
type StringUintTuple ¶ added in v0.3.0
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) // 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 []uint64
Uint64List is a slice of type uint64. Use it where you would use []uint64. To add items to the list, simply use the normal built-in append function.
List values follow a similar pattern to Scala Lists and LinearSeqs in particular. 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 MakeUint64List ¶ added in v0.3.0
func MakeUint64List(length, capacity int) Uint64List
MakeUint64List makes an empty list with both length and capacity initialised.
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) Clone ¶ added in v0.3.0
func (list Uint64List) Clone() Uint64List
Clone returns a shallow copy of the list. It does not clone the underlying elements.
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) DoReverse ¶ added in v0.3.0
func (list Uint64List) DoReverse() Uint64List
DoReverse alters a Uint64List with all elements in the reverse order. Unlike Reverse, it does not allocate new memory.
The list is modified and the modified list is returned.
func (Uint64List) DoShuffle ¶ added in v0.3.0
func (list Uint64List) DoShuffle() Uint64List
DoShuffle returns a shuffled Uint64List, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
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.
The original list is not modified.
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.
The original list is not modified.
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.
The original list is not modified.
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.
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.
The original list is not modified.
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. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (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. The list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Uint64List) Fold ¶ added in v0.9.0
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.
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. The simple list is a dressed-up slice and normal slice operations will also work.
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(). This is one of the three methods in the standard sort.Interface.
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. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (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. The list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (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.
The original list is not modified.
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.
The original list is not modified.
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.
The original list is not modified.
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 alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (Uint64List) Sorted ¶ added in v0.3.0
func (list Uint64List) Sorted() Uint64List
Sorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (Uint64List) StableSortBy ¶ added in v0.3.0
func (list Uint64List) StableSortBy(less func(i, j uint64) bool) Uint64List
StableSortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned. The algorithm keeps the original order of equal elements.
func (Uint64List) StableSorted ¶ added in v0.3.0
func (list Uint64List) StableSorted() Uint64List
StableSorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
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) Swap ¶ added in v0.3.0
func (list Uint64List) Swap(i, j int)
Swap exchanges two elements, which is necessary during sorting etc. This is one of the three methods in the standard sort.Interface.
func (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.
The original list is not modified.
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.
The original list is not modified.
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 list as a slice, which is an identity operation in this case, because the simple list is merely a dressed-up slice.
type Uint64MkStringer ¶ added in v0.3.0
type Uint64MkStringer interface { // String implements the Stringer interface to render the collection 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 // StringList gets a collection of strings that depicts all the elements. StringList() []string }
Uint64MkStringer defines an interface for stringer methods on uint64 collections.
type Uint64Queue ¶ added in v0.9.0
type Uint64Queue struct {
// contains filtered or unexported fields
}
Uint64Queue is a ring buffer containing a slice of type uint64. It is optimised for FIFO operations.
func BuildUint64QueueFromChan ¶ added in v0.9.0
func BuildUint64QueueFromChan(source <-chan uint64) *Uint64Queue
BuildUint64QueueFromChan constructs a new Uint64Queue from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func NewUint64Queue ¶ added in v0.9.0
func NewUint64Queue(capacity int, overwrite bool) *Uint64Queue
NewUint64Queue returns a new queue of uint64. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue.
func NewUint64SortedQueue ¶ added in v0.9.0
func NewUint64SortedQueue(capacity int, overwrite bool, less func(i, j uint64) bool) *Uint64Queue
NewUint64SortedQueue returns a new queue of uint64. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue. If the 'less' comparison function is not nil, elements can be easily sorted.
func (*Uint64Queue) Add ¶ added in v0.9.0
func (queue *Uint64Queue) Add(more ...uint64)
Add adds items to the queue. This is a synonym for Push.
func (*Uint64Queue) Cap ¶ added in v0.9.0
func (queue *Uint64Queue) Cap() int
Cap gets the capacity of this queue.
func (*Uint64Queue) Clear ¶ added in v0.9.0
func (queue *Uint64Queue) Clear()
Clear the entire queue.
func (*Uint64Queue) Clone ¶ added in v0.9.0
func (queue *Uint64Queue) Clone() *Uint64Queue
Clone returns a shallow copy of the queue. It does not clone the underlying elements.
func (*Uint64Queue) Contains ¶ added in v0.9.0
func (queue *Uint64Queue) Contains(v uint64) bool
Contains determines whether a given item is already in the queue, returning true if so.
func (*Uint64Queue) ContainsAll ¶ added in v0.9.0
func (queue *Uint64Queue) ContainsAll(i ...uint64) bool
ContainsAll determines whether the given items are all in the queue, returning true if so. This is potentially a slow method and should only be used rarely.
func (*Uint64Queue) CountBy ¶ added in v0.9.0
func (queue *Uint64Queue) CountBy(p func(uint64) bool) (result int)
CountBy gives the number elements of Uint64Queue that return true for the predicate p.
func (*Uint64Queue) DoKeepWhere ¶ added in v0.9.0
func (queue *Uint64Queue) DoKeepWhere(p func(uint64) bool) *Uint64Queue
DoKeepWhere modifies a Uint64Queue by retaining only those elements that match the predicate p. This is very similar to Filter but alters the queue in place.
The queue is modified and the modified queue is returned.
func (*Uint64Queue) Equals ¶ added in v0.9.0
func (queue *Uint64Queue) Equals(other *Uint64Queue) bool
Equals determines if two queues are equal to each other. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal. Nil queues are considered to be empty.
func (*Uint64Queue) Exists ¶ added in v0.9.0
func (queue *Uint64Queue) Exists(p func(uint64) bool) bool
Exists verifies that one or more elements of Uint64Queue return true for the predicate p. The function should not alter the values via side-effects.
func (*Uint64Queue) Filter ¶ added in v0.9.0
func (queue *Uint64Queue) Filter(p func(uint64) bool) *Uint64Queue
Filter returns a new Uint64Queue whose elements return true for predicate p.
The original queue is not modified. See also DoKeepWhere (which does modify the original queue).
func (*Uint64Queue) Find ¶ added in v0.9.0
func (queue *Uint64Queue) 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 (*Uint64Queue) FlatMap ¶ added in v0.9.0
func (queue *Uint64Queue) FlatMap(f func(uint64) []uint64) *Uint64Queue
FlatMap returns a new Uint64Queue by transforming every element with function f that returns zero or more items in a slice. The resulting queue may have a different size to the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*Uint64Queue) FlatMapToString ¶ added in v0.9.0
func (queue *Uint64Queue) 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 queue. The queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*Uint64Queue) Fold ¶ added in v0.9.0
Fold aggregates all the values in the queue using a supplied function, starting from some initial value.
func (*Uint64Queue) Forall ¶ added in v0.9.0
func (queue *Uint64Queue) Forall(p func(uint64) bool) bool
Forall verifies that all elements of Uint64Queue return true for the predicate p. The function should not alter the values via side-effects.
func (*Uint64Queue) Foreach ¶ added in v0.9.0
func (queue *Uint64Queue) Foreach(f func(uint64))
Foreach iterates over Uint64Queue and executes function f against each element. The function can safely alter the values via side-effects.
func (*Uint64Queue) Get ¶ added in v0.9.0
func (queue *Uint64Queue) Get(i int) uint64
Get gets the specified element in the queue. Panics if the index is out of range or the queue is nil.
func (*Uint64Queue) Head ¶ added in v0.9.0
func (queue *Uint64Queue) Head() uint64
Head gets the first element in the queue. Head is the opposite of Last. Panics if queue is empty or nil.
func (*Uint64Queue) HeadOption ¶ added in v0.9.0
func (queue *Uint64Queue) HeadOption() (uint64, bool)
HeadOption returns the oldest item in the queue without removing it. If the queue is nil or empty, it returns the zero value instead.
func (*Uint64Queue) IsEmpty ¶ added in v0.9.0
func (queue *Uint64Queue) IsEmpty() bool
IsEmpty returns true if the queue is empty.
func (*Uint64Queue) IsFull ¶ added in v0.9.0
func (queue *Uint64Queue) IsFull() bool
IsFull returns true if the queue is full.
func (*Uint64Queue) IsOverwriting ¶ added in v0.9.0
func (queue *Uint64Queue) IsOverwriting() bool
IsOverwriting returns true if the queue is overwriting, false if refusing.
func (*Uint64Queue) IsSequence ¶ added in v0.9.0
func (queue *Uint64Queue) IsSequence() bool
IsSequence returns true for ordered lists and queues.
func (*Uint64Queue) IsSet ¶ added in v0.9.0
func (queue *Uint64Queue) IsSet() bool
IsSet returns false for lists or queues.
func (*Uint64Queue) Last ¶ added in v0.9.0
func (queue *Uint64Queue) Last() uint64
Last gets the the newest item in the queue (i.e. last element pushed) without removing it. Last is the opposite of Head. Panics if queue is empty or nil.
func (*Uint64Queue) LastOption ¶ added in v0.9.0
func (queue *Uint64Queue) LastOption() (uint64, bool)
LastOption returns the newest item in the queue without removing it. If the queue is nil empty, it returns the zero value instead.
func (*Uint64Queue) Len ¶ added in v0.9.0
func (queue *Uint64Queue) Len() int
Len gets the current length of this queue. This is an alias for Size.
func (*Uint64Queue) Less ¶ added in v0.9.0
func (queue *Uint64Queue) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j. The queue must have been created with a non-nil 'less' comparison function and it must not be empty.
func (*Uint64Queue) Map ¶ added in v0.9.0
func (queue *Uint64Queue) Map(f func(uint64) uint64) *Uint64Queue
Map returns a new Uint64Queue by transforming every element with function f. The resulting queue is the same size as the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*Uint64Queue) MapToString ¶ added in v0.9.0
func (queue *Uint64Queue) 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 queue. The queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Uint64Queue) MarshalJSON ¶ added in v0.9.0
func (queue Uint64Queue) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this queue type.
func (*Uint64Queue) Max ¶ added in v0.9.0
func (queue *Uint64Queue) Max() (result uint64)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (*Uint64Queue) MaxBy ¶ added in v0.9.0
func (queue *Uint64Queue) MaxBy(less func(uint64, uint64) bool) uint64
MaxBy returns an element of Uint64Queue 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 (*Uint64Queue) Min ¶ added in v0.9.0
func (queue *Uint64Queue) Min() uint64
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (*Uint64Queue) MinBy ¶ added in v0.9.0
func (queue *Uint64Queue) MinBy(less func(uint64, uint64) bool) uint64
MinBy returns an element of Uint64Queue 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 (*Uint64Queue) MkString ¶ added in v0.9.0
func (queue *Uint64Queue) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*Uint64Queue) MkString3 ¶ added in v0.9.0
func (queue *Uint64Queue) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*Uint64Queue) NonEmpty ¶ added in v0.9.0
func (queue *Uint64Queue) NonEmpty() bool
NonEmpty returns true if the queue is not empty.
func (*Uint64Queue) Offer ¶ added in v0.9.0
func (queue *Uint64Queue) Offer(items ...uint64) []uint64
Offer appends as many items to the end of the queue as it can. If the queue is already full, what happens depends on whether the queue is configured to overwrite. If it is, the oldest items will be overwritten. Otherwise, it will be filled to capacity and any unwritten items are returned.
If the capacity is too small for the number of items, the excess items are returned. The queue capacity is never altered.
func (*Uint64Queue) Partition ¶ added in v0.9.0
func (queue *Uint64Queue) Partition(p func(uint64) bool) (*Uint64Queue, *Uint64Queue)
Partition returns two new Uint64Queues 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 queue.
The original queue is not modified
func (*Uint64Queue) Pop ¶ added in v0.9.0
func (queue *Uint64Queue) Pop(n int) []uint64
Pop removes and returns the oldest items from the queue. If the queue is empty, it returns a nil slice. If n is larger than the current queue length, it returns all the available elements, so in this case the returned slice will be shorter than n.
func (*Uint64Queue) Pop1 ¶ added in v0.9.0
func (queue *Uint64Queue) Pop1() (uint64, bool)
Pop1 removes and returns the oldest item from the queue. If the queue is empty, it returns the zero value instead. The boolean is true only if the element was available.
func (*Uint64Queue) Push ¶ added in v0.9.0
func (queue *Uint64Queue) Push(items ...uint64) *Uint64Queue
Push appends items to the end of the queue. If the queue does not have enough space, more will be allocated: how this happens depends on the overwriting mode.
When overwriting, the oldest items are overwritten with the new data; it expands the queue only if there is still not enough space.
Otherwise, the queue might be reallocated if necessary, ensuring that all the data is pushed without any older items being affected.
The modified queue is returned.
func (*Uint64Queue) Reallocate ¶ added in v0.9.0
func (queue *Uint64Queue) Reallocate(capacity int, overwrite bool) *Uint64Queue
Reallocate adjusts the allocated capacity of the queue and allows the overwriting behaviour to be changed.
If the new queue capacity is different to the current capacity, the queue is re-allocated to the new capacity. If this is less than the current number of elements, the oldest items in the queue are discarded so that the remaining data can fit in the new space available.
If the new queue capacity is the same as the current capacity, the queue is not altered except for adopting the new overwrite flag's value. Therefore this is the means to change the overwriting behaviour.
Reallocate adjusts the storage space but does not clone the underlying elements.
The queue must not be nil.
func (*Uint64Queue) Send ¶ added in v0.9.0
func (queue *Uint64Queue) 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 (*Uint64Queue) Size ¶ added in v0.9.0
func (queue *Uint64Queue) Size() int
Size gets the number of elements currently in this queue. This is an alias for Len.
func (*Uint64Queue) Sort ¶ added in v0.9.0
func (queue *Uint64Queue) Sort()
Sort sorts the queue using the 'less' comparison function, which must not be nil. This function will panic if the collection was created with a nil 'less' function (see NewUint64SortedQueue).
func (*Uint64Queue) Space ¶ added in v0.9.0
func (queue *Uint64Queue) Space() int
Space returns the space available in the queue.
func (*Uint64Queue) StableSort ¶ added in v0.9.0
func (queue *Uint64Queue) StableSort()
StableSort sorts the queue using the 'less' comparison function, which must not be nil. The result is stable so that repeated calls will not arbitrarily swap equal items. This function will panic if the collection was created with a nil 'less' function (see NewUint64SortedQueue).
func (*Uint64Queue) String ¶ added in v0.9.0
func (queue *Uint64Queue) String() string
String implements the Stringer interface to render the queue as a comma-separated string enclosed in square brackets.
func (*Uint64Queue) StringList ¶ added in v0.9.0
func (queue *Uint64Queue) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (*Uint64Queue) Sum ¶ added in v0.9.0
func (queue *Uint64Queue) Sum() uint64
Sum returns the sum of all the elements in the queue.
func (*Uint64Queue) Swap ¶ added in v0.9.0
func (queue *Uint64Queue) Swap(i, j int)
Swap swaps the elements with indexes i and j. The queue must not be empty.
func (*Uint64Queue) ToInterfaceSlice ¶ added in v0.9.0
func (queue *Uint64Queue) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the queue as a slice of arbitrary type. The queue is not altered.
func (*Uint64Queue) ToSlice ¶ added in v0.9.0
func (queue *Uint64Queue) ToSlice() []uint64
ToSlice returns the elements of the queue as a slice. The queue is not altered.
func (*Uint64Queue) UnmarshalJSON ¶ added in v0.9.0
func (queue *Uint64Queue) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this queue type.
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 map[uint64]struct{}
Uint64Set is the primary type that represents a set
func BuildUint64SetFromChan ¶ added in v0.3.0
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
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
NewUint64Set creates and returns a reference to an empty set.
func (Uint64Set) Add ¶ added in v0.3.0
Add adds items to the current set, returning the modified set.
func (Uint64Set) Append ¶ added in v0.3.0
Append inserts more items into a clone of the set. It returns the augmented set. The original set is unmodified.
func (Uint64Set) Cardinality ¶ added in v0.3.0
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*Uint64Set) Clear ¶ added in v0.3.0
func (set *Uint64Set) Clear()
Clear the entire set. Aterwards, it will be an empty set.
func (Uint64Set) Clone ¶ added in v0.3.0
Clone returns a shallow copy of the set. It does not clone the underlying elements.
func (Uint64Set) Contains ¶ added in v0.3.0
Contains determines whether a given item is already in the set, returning true if so.
func (Uint64Set) ContainsAll ¶ added in v0.3.0
ContainsAll determines whether a given item is already in the set, returning true if so.
func (Uint64Set) CountBy ¶ added in v0.3.0
CountBy gives the number elements of Uint64Set that return true for the predicate p.
func (Uint64Set) Difference ¶ added in v0.3.0
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
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
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
Filter returns a new Uint64Set whose elements return true for the predicate p.
The original set is not modified
func (Uint64Set) Find ¶ added in v0.3.0
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
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. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Uint64Set) FlatMapToString ¶ added in v0.3.0
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. The set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Uint64Set) Fold ¶ added in v0.9.0
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
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
Foreach iterates over the set and executes the function f against each element.
func (Uint64Set) Intersect ¶ added in v0.3.0
Intersect returns a new set with items that exist only in both sets.
func (Uint64Set) IsSequence ¶ added in v0.3.0
IsSequence returns true for lists and queues.
func (Uint64Set) IsSubset ¶ added in v0.3.0
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
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
Map returns a new Uint64Set by transforming every element with a function f. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Uint64Set) MapToString ¶ added in v0.3.0
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set. The set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Uint64Set) MarshalJSON ¶ added in v0.3.0
MarshalJSON implements JSON encoding for this set type.
func (Uint64Set) Max ¶ added in v0.3.0
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
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
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
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
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (Uint64Set) MkString3 ¶ added in v0.3.0
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (Uint64Set) Partition ¶ added in v0.3.0
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 original set is not modified
func (Uint64Set) Send ¶ added in v0.3.0
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
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (Uint64Set) String ¶ added in v0.3.0
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
StringList gets a list of strings that depicts all the elements.
func (Uint64Set) StringMap ¶ added in v0.3.0
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) SymmetricDifference ¶ added in v0.3.0
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
ToSet returns the set; this is an identity operation in this case.
func (Uint64Set) ToSlice ¶ added in v0.3.0
ToSlice returns the elements of the current set as a slice.
func (Uint64Set) UnmarshalJSON ¶ added in v0.3.0
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 collection - an alias of Len(). Size() int }
Uint64Sizer defines an interface for sizing methods on uint64 collections.
type Uint64StringMap ¶ added in v0.4.0
Uint64StringMap is the primary type that represents a 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) Clear ¶ added in v0.4.0
func (mm *Uint64StringMap) Clear()
Clear clears the entire map.
func (Uint64StringMap) Clone ¶ added in v0.4.0
func (mm Uint64StringMap) Clone() Uint64StringMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
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) DropWhere ¶ added in v0.4.0
func (mm Uint64StringMap) DropWhere(fn func(uint64, string) bool) Uint64StringTuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
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. The original map is not modified.
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. The original map is not modified.
func (Uint64StringMap) FlatMap ¶ added in v0.4.0
func (mm Uint64StringMap) FlatMap(f func(uint64, string) []Uint64StringTuple) Uint64StringMap
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Uint64StringMap) Forall ¶ added in v0.4.0
func (mm Uint64StringMap) Forall(p 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) 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
func (mm Uint64StringMap) Keys() Uint64List
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (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
func (mm Uint64StringMap) OrderedSlice(keys Uint64List) Uint64StringTuples
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. The original map is not modified.
func (Uint64StringMap) Pop ¶ added in v0.4.0
func (mm Uint64StringMap) Pop(k uint64) (string, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (Uint64StringMap) Put ¶ added in v0.4.0
func (mm Uint64StringMap) Put(k uint64, v string) bool
Put adds an item to the current map, replacing any prior value.
func (Uint64StringMap) Remove ¶ added in v0.4.0
func (mm Uint64StringMap) Remove(k uint64)
Remove a single item from the 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() StringList
Values returns the values of the current map as a slice.
type Uint64StringTuple ¶ added in v0.4.0
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
func (ts Uint64StringTuples) Append1(k uint64, v string) Uint64StringTuples
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
Uint64Uint64Map is the primary type that represents a 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) Clear ¶ added in v0.3.0
func (mm *Uint64Uint64Map) Clear()
Clear clears the entire map.
func (Uint64Uint64Map) Clone ¶ added in v0.3.0
func (mm Uint64Uint64Map) Clone() Uint64Uint64Map
Clone returns a shallow copy of the map. It does not clone the underlying elements.
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) DropWhere ¶ added in v0.3.0
func (mm Uint64Uint64Map) DropWhere(fn func(uint64, uint64) bool) Uint64Uint64Tuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
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. The original map is not modified.
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. The original map is not modified.
func (Uint64Uint64Map) FlatMap ¶ added in v0.3.0
func (mm Uint64Uint64Map) FlatMap(f func(uint64, uint64) []Uint64Uint64Tuple) Uint64Uint64Map
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (Uint64Uint64Map) Forall ¶ added in v0.3.0
func (mm Uint64Uint64Map) Forall(p 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) 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
func (mm Uint64Uint64Map) Keys() Uint64List
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (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
func (mm Uint64Uint64Map) OrderedSlice(keys Uint64List) Uint64Uint64Tuples
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. The original map is not modified.
func (Uint64Uint64Map) Pop ¶ added in v0.3.0
func (mm Uint64Uint64Map) Pop(k uint64) (uint64, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (Uint64Uint64Map) Put ¶ added in v0.3.0
func (mm Uint64Uint64Map) Put(k uint64, v uint64) bool
Put adds an item to the current map, replacing any prior value.
func (Uint64Uint64Map) Remove ¶ added in v0.3.0
func (mm Uint64Uint64Map) Remove(k uint64)
Remove a single item from the 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() Uint64List
Values returns the values of the current map as a slice.
type Uint64Uint64Tuple ¶ added in v0.3.0
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
func (ts Uint64Uint64Tuples) Append1(k uint64, v uint64) Uint64Uint64Tuples
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) // 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 []uint
UintList is a slice of type uint. Use it where you would use []uint. To add items to the list, simply use the normal built-in append function.
List values follow a similar pattern to Scala Lists and LinearSeqs in particular. 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
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
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 MakeUintList ¶ added in v0.3.0
MakeUintList makes an empty list with both length and capacity initialised.
func NewUintList ¶ added in v0.3.0
NewUintList constructs a new list containing the supplied values, if any.
func (UintList) Clone ¶ added in v0.3.0
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (UintList) Contains ¶ added in v0.3.0
Contains determines whether a given item is already in the list, returning true if so.
func (UintList) ContainsAll ¶ added in v0.3.0
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
CountBy gives the number elements of UintList that return true for the predicate p.
func (UintList) DistinctBy ¶ added in v0.3.0
DistinctBy returns a new UintList whose elements are unique, where equality is defined by the equal function.
func (UintList) DoReverse ¶ added in v0.3.0
DoReverse alters a UintList with all elements in the reverse order. Unlike Reverse, it does not allocate new memory.
The list is modified and the modified list is returned.
func (UintList) DoShuffle ¶ added in v0.3.0
DoShuffle returns a shuffled UintList, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (UintList) Drop ¶ added in v0.3.0
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.
The original list is not modified.
func (UintList) DropLast ¶ added in v0.3.0
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.
The original list is not modified.
func (UintList) DropWhile ¶ added in v0.3.0
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.
The original list is not modified.
func (UintList) Equals ¶ added in v0.3.0
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal.
func (UintList) Exists ¶ added in v0.3.0
Exists verifies that one or more elements of UintList return true for the predicate p.
func (UintList) Filter ¶ added in v0.3.0
Filter returns a new UintList whose elements return true for predicate p.
The original list is not modified.
func (UintList) Find ¶ added in v0.3.0
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
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. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (UintList) FlatMapToString ¶ added in v0.3.0
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. The list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (UintList) Fold ¶ added in v0.9.0
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
Forall verifies that all elements of UintList return true for the predicate p.
func (UintList) Foreach ¶ added in v0.3.0
Foreach iterates over UintList and executes function f against each element.
func (UintList) Get ¶ added in v0.3.0
Get gets the specified element in the list. Panics if the index is out of range or the list is nil. The simple list is a dressed-up slice and normal slice operations will also work.
func (UintList) GobDecode ¶ added in v0.3.0
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
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
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
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (UintList) IndexWhere ¶ added in v0.3.0
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
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
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) IsSequence ¶ added in v0.3.0
IsSequence returns true for lists and queues.
func (UintList) Last ¶ added in v0.3.0
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
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
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
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (UintList) Len ¶ added in v0.3.0
Len returns the number of items in the list - an alias of Size(). This is one of the three methods in the standard sort.Interface.
func (UintList) Map ¶ added in v0.3.0
Map returns a new UintList by transforming every element with function f. The resulting list is the same size as the original list. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (UintList) MapToString ¶ added in v0.3.0
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the list. The list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (UintList) Max ¶ added in v0.3.0
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
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
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
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
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (UintList) MkString3 ¶ added in v0.3.0
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (UintList) Partition ¶ added in v0.3.0
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.
The original list is not modified.
func (UintList) Reverse ¶ added in v0.3.0
Reverse returns a copy of UintList with all elements in the reverse order.
The original list is not modified.
func (UintList) Send ¶ added in v0.3.0
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
Shuffle returns a shuffled copy of UintList, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (UintList) Size ¶ added in v0.3.0
Size returns the number of items in the list - an alias of Len().
func (UintList) SortBy ¶ added in v0.3.0
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (UintList) Sorted ¶ added in v0.3.0
Sorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (UintList) StableSortBy ¶ added in v0.3.0
StableSortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned. The algorithm keeps the original order of equal elements.
func (UintList) StableSorted ¶ added in v0.3.0
StableSorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (UintList) String ¶ added in v0.3.0
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
StringList gets a list of strings that depicts all the elements.
func (UintList) Swap ¶ added in v0.3.0
Swap exchanges two elements, which is necessary during sorting etc. This is one of the three methods in the standard sort.Interface.
func (UintList) Tail ¶ added in v0.3.0
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
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
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.
The original list is not modified.
func (UintList) TakeWhile ¶ added in v0.3.0
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.
The original list is not modified.
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
ToList returns the elements of the list as a list, which is an identity operation in this case.
type UintMkStringer ¶ added in v0.3.0
type UintMkStringer interface { // String implements the Stringer interface to render the collection 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 // StringList gets a collection of strings that depicts all the elements. StringList() []string }
UintMkStringer defines an interface for stringer methods on uint collections.
type UintQueue ¶ added in v0.9.0
type UintQueue struct {
// contains filtered or unexported fields
}
UintQueue is a ring buffer containing a slice of type uint. It is optimised for FIFO operations.
func BuildUintQueueFromChan ¶ added in v0.9.0
BuildUintQueueFromChan constructs a new UintQueue from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func NewUintQueue ¶ added in v0.9.0
NewUintQueue returns a new queue of uint. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue.
func NewUintSortedQueue ¶ added in v0.9.0
NewUintSortedQueue returns a new queue of uint. The behaviour when adding to the queue depends on overwrite. If true, the push operation overwrites oldest values up to the space available, when the queue is full. Otherwise, it refuses to overfill the queue. If the 'less' comparison function is not nil, elements can be easily sorted.
func (*UintQueue) Clone ¶ added in v0.9.0
Clone returns a shallow copy of the queue. It does not clone the underlying elements.
func (*UintQueue) Contains ¶ added in v0.9.0
Contains determines whether a given item is already in the queue, returning true if so.
func (*UintQueue) ContainsAll ¶ added in v0.9.0
ContainsAll determines whether the given items are all in the queue, returning true if so. This is potentially a slow method and should only be used rarely.
func (*UintQueue) CountBy ¶ added in v0.9.0
CountBy gives the number elements of UintQueue that return true for the predicate p.
func (*UintQueue) DoKeepWhere ¶ added in v0.9.0
DoKeepWhere modifies a UintQueue by retaining only those elements that match the predicate p. This is very similar to Filter but alters the queue in place.
The queue is modified and the modified queue is returned.
func (*UintQueue) Equals ¶ added in v0.9.0
Equals determines if two queues are equal to each other. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal. Nil queues are considered to be empty.
func (*UintQueue) Exists ¶ added in v0.9.0
Exists verifies that one or more elements of UintQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*UintQueue) Filter ¶ added in v0.9.0
Filter returns a new UintQueue whose elements return true for predicate p.
The original queue is not modified. See also DoKeepWhere (which does modify the original queue).
func (*UintQueue) Find ¶ added in v0.9.0
Find returns the first uint that returns true for predicate p. False is returned if none match.
func (*UintQueue) FlatMap ¶ added in v0.9.0
FlatMap returns a new UintQueue by transforming every element with function f that returns zero or more items in a slice. The resulting queue may have a different size to the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*UintQueue) FlatMapToString ¶ added in v0.9.0
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 queue. The queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*UintQueue) Fold ¶ added in v0.9.0
Fold aggregates all the values in the queue using a supplied function, starting from some initial value.
func (*UintQueue) Forall ¶ added in v0.9.0
Forall verifies that all elements of UintQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*UintQueue) Foreach ¶ added in v0.9.0
Foreach iterates over UintQueue and executes function f against each element. The function can safely alter the values via side-effects.
func (*UintQueue) Get ¶ added in v0.9.0
Get gets the specified element in the queue. Panics if the index is out of range or the queue is nil.
func (*UintQueue) Head ¶ added in v0.9.0
Head gets the first element in the queue. Head is the opposite of Last. Panics if queue is empty or nil.
func (*UintQueue) HeadOption ¶ added in v0.9.0
HeadOption returns the oldest item in the queue without removing it. If the queue is nil or empty, it returns the zero value instead.
func (*UintQueue) IsOverwriting ¶ added in v0.9.0
IsOverwriting returns true if the queue is overwriting, false if refusing.
func (*UintQueue) IsSequence ¶ added in v0.9.0
IsSequence returns true for ordered lists and queues.
func (*UintQueue) Last ¶ added in v0.9.0
Last gets the the newest item in the queue (i.e. last element pushed) without removing it. Last is the opposite of Head. Panics if queue is empty or nil.
func (*UintQueue) LastOption ¶ added in v0.9.0
LastOption returns the newest item in the queue without removing it. If the queue is nil empty, it returns the zero value instead.
func (*UintQueue) Len ¶ added in v0.9.0
Len gets the current length of this queue. This is an alias for Size.
func (*UintQueue) Less ¶ added in v0.9.0
Less reports whether the element with index i should sort before the element with index j. The queue must have been created with a non-nil 'less' comparison function and it must not be empty.
func (*UintQueue) Map ¶ added in v0.9.0
Map returns a new UintQueue by transforming every element with function f. The resulting queue is the same size as the original queue. The original queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*UintQueue) MapToString ¶ added in v0.9.0
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the queue. The queue is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (UintQueue) MarshalJSON ¶ added in v0.9.0
MarshalJSON implements JSON encoding for this queue type.
func (*UintQueue) Max ¶ added in v0.9.0
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (*UintQueue) MaxBy ¶ added in v0.9.0
MaxBy returns an element of UintQueue 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 (*UintQueue) Min ¶ added in v0.9.0
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (*UintQueue) MinBy ¶ added in v0.9.0
MinBy returns an element of UintQueue 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 (*UintQueue) MkString ¶ added in v0.9.0
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*UintQueue) MkString3 ¶ added in v0.9.0
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*UintQueue) Offer ¶ added in v0.9.0
Offer appends as many items to the end of the queue as it can. If the queue is already full, what happens depends on whether the queue is configured to overwrite. If it is, the oldest items will be overwritten. Otherwise, it will be filled to capacity and any unwritten items are returned.
If the capacity is too small for the number of items, the excess items are returned. The queue capacity is never altered.
func (*UintQueue) Partition ¶ added in v0.9.0
Partition returns two new UintQueues 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 queue.
The original queue is not modified
func (*UintQueue) Pop ¶ added in v0.9.0
Pop removes and returns the oldest items from the queue. If the queue is empty, it returns a nil slice. If n is larger than the current queue length, it returns all the available elements, so in this case the returned slice will be shorter than n.
func (*UintQueue) Pop1 ¶ added in v0.9.0
Pop1 removes and returns the oldest item from the queue. If the queue is empty, it returns the zero value instead. The boolean is true only if the element was available.
func (*UintQueue) Push ¶ added in v0.9.0
Push appends items to the end of the queue. If the queue does not have enough space, more will be allocated: how this happens depends on the overwriting mode.
When overwriting, the oldest items are overwritten with the new data; it expands the queue only if there is still not enough space.
Otherwise, the queue might be reallocated if necessary, ensuring that all the data is pushed without any older items being affected.
The modified queue is returned.
func (*UintQueue) Reallocate ¶ added in v0.9.0
Reallocate adjusts the allocated capacity of the queue and allows the overwriting behaviour to be changed.
If the new queue capacity is different to the current capacity, the queue is re-allocated to the new capacity. If this is less than the current number of elements, the oldest items in the queue are discarded so that the remaining data can fit in the new space available.
If the new queue capacity is the same as the current capacity, the queue is not altered except for adopting the new overwrite flag's value. Therefore this is the means to change the overwriting behaviour.
Reallocate adjusts the storage space but does not clone the underlying elements.
The queue must not be nil.
func (*UintQueue) Send ¶ added in v0.9.0
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 (*UintQueue) Size ¶ added in v0.9.0
Size gets the number of elements currently in this queue. This is an alias for Len.
func (*UintQueue) Sort ¶ added in v0.9.0
func (queue *UintQueue) Sort()
Sort sorts the queue using the 'less' comparison function, which must not be nil. This function will panic if the collection was created with a nil 'less' function (see NewUintSortedQueue).
func (*UintQueue) StableSort ¶ added in v0.9.0
func (queue *UintQueue) StableSort()
StableSort sorts the queue using the 'less' comparison function, which must not be nil. The result is stable so that repeated calls will not arbitrarily swap equal items. This function will panic if the collection was created with a nil 'less' function (see NewUintSortedQueue).
func (*UintQueue) String ¶ added in v0.9.0
String implements the Stringer interface to render the queue as a comma-separated string enclosed in square brackets.
func (*UintQueue) StringList ¶ added in v0.9.0
StringList gets a list of strings that depicts all the elements.
func (*UintQueue) Swap ¶ added in v0.9.0
Swap swaps the elements with indexes i and j. The queue must not be empty.
func (*UintQueue) ToInterfaceSlice ¶ added in v0.9.0
func (queue *UintQueue) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the queue as a slice of arbitrary type. The queue is not altered.
func (*UintQueue) ToSlice ¶ added in v0.9.0
ToSlice returns the elements of the queue as a slice. The queue is not altered.
func (*UintQueue) UnmarshalJSON ¶ added in v0.9.0
UnmarshalJSON implements JSON decoding for this queue type.
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 map[uint]struct{}
UintSet is the primary type that represents a set
func BuildUintSetFromChan ¶ added in v0.3.0
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
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
NewUintSet creates and returns a reference to an empty set.
func (UintSet) Append ¶ added in v0.3.0
Append inserts more items into a clone of the set. It returns the augmented set. The original set is unmodified.
func (UintSet) Cardinality ¶ added in v0.3.0
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*UintSet) Clear ¶ added in v0.3.0
func (set *UintSet) Clear()
Clear the entire set. Aterwards, it will be an empty set.
func (UintSet) Clone ¶ added in v0.3.0
Clone returns a shallow copy of the set. It does not clone the underlying elements.
func (UintSet) Contains ¶ added in v0.3.0
Contains determines whether a given item is already in the set, returning true if so.
func (UintSet) ContainsAll ¶ added in v0.3.0
ContainsAll determines whether a given item is already in the set, returning true if so.
func (UintSet) CountBy ¶ added in v0.3.0
CountBy gives the number elements of UintSet that return true for the predicate p.
func (UintSet) Difference ¶ added in v0.3.0
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
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
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
Filter returns a new UintSet whose elements return true for the predicate p.
The original set is not modified
func (UintSet) Find ¶ added in v0.3.0
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
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. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (UintSet) FlatMapToString ¶ added in v0.3.0
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. The set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (UintSet) Fold ¶ added in v0.9.0
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
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
Foreach iterates over the set and executes the function f against each element.
func (UintSet) Intersect ¶ added in v0.3.0
Intersect returns a new set with items that exist only in both sets.
func (UintSet) IsSequence ¶ added in v0.3.0
IsSequence returns true for lists and queues.
func (UintSet) IsSubset ¶ added in v0.3.0
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
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
Map returns a new UintSet by transforming every element with a function f. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (UintSet) MapToString ¶ added in v0.3.0
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set. The set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (UintSet) MarshalJSON ¶ added in v0.3.0
MarshalJSON implements JSON encoding for this set type.
func (UintSet) Max ¶ added in v0.3.0
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
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
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
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
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (UintSet) MkString3 ¶ added in v0.3.0
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (UintSet) Partition ¶ added in v0.3.0
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 original set is not modified
func (UintSet) Send ¶ added in v0.3.0
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
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (UintSet) String ¶ added in v0.3.0
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
StringList gets a list of strings that depicts all the elements.
func (UintSet) StringMap ¶ added in v0.3.0
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) SymmetricDifference ¶ added in v0.3.0
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
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
ToSet returns the set; this is an identity operation in this case.
func (UintSet) ToSlice ¶ added in v0.3.0
ToSlice returns the elements of the current set as a slice.
func (UintSet) UnmarshalJSON ¶ added in v0.3.0
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 collection - an alias of Len(). Size() int }
UintSizer defines an interface for sizing methods on uint collections.
type UintStringMap ¶ added in v0.3.0
UintStringMap is the primary type that represents a 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) Clear ¶ added in v0.3.0
func (mm *UintStringMap) Clear()
Clear clears the entire map.
func (UintStringMap) Clone ¶ added in v0.3.0
func (mm UintStringMap) Clone() UintStringMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
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) DropWhere ¶ added in v0.3.0
func (mm UintStringMap) DropWhere(fn func(uint, string) bool) UintStringTuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
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. The original map is not modified.
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. The original map is not modified.
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (UintStringMap) Forall ¶ added in v0.3.0
func (mm UintStringMap) Forall(p 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) 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() 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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (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 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. The original map is not modified.
func (UintStringMap) Pop ¶ added in v0.3.0
func (mm UintStringMap) Pop(k uint) (string, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (UintStringMap) Put ¶ added in v0.3.0
func (mm UintStringMap) Put(k uint, v string) bool
Put adds an item to the current map, replacing any prior value.
func (UintStringMap) Remove ¶ added in v0.3.0
func (mm UintStringMap) Remove(k uint)
Remove a single item from the 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() StringList
Values returns the values of the current map as a slice.
type UintStringTuple ¶ added in v0.3.0
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
UintUintMap is the primary type that represents a 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) Clear ¶ added in v0.3.0
func (mm *UintUintMap) Clear()
Clear clears the entire map.
func (UintUintMap) Clone ¶ added in v0.3.0
func (mm UintUintMap) Clone() UintUintMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
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) DropWhere ¶ added in v0.3.0
func (mm UintUintMap) DropWhere(fn func(uint, uint) bool) UintUintTuples
DropWhere applies a predicate function to every element in the map. If the function returns true, the element is dropped from the map. This is similar to Filter except that the map is modified.
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. The original map is not modified.
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. The original map is not modified.
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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (UintUintMap) Forall ¶ added in v0.3.0
func (mm UintUintMap) Forall(p 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) 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() 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. The original map is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (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 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. The original map is not modified.
func (UintUintMap) Pop ¶ added in v0.3.0
func (mm UintUintMap) Pop(k uint) (uint, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (UintUintMap) Put ¶ added in v0.3.0
func (mm UintUintMap) Put(k uint, v uint) bool
Put adds an item to the current map, replacing any prior value.
func (UintUintMap) Remove ¶ added in v0.3.0
func (mm UintUintMap) Remove(k uint)
Remove a single item from the 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() UintList
Values returns the values of the current map as a slice.
type UintUintTuple ¶ added in v0.3.0
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.
Source Files
¶
- any_collection.go
- any_list.go
- any_queue.go
- any_set.go
- assertions.go
- doc.go
- int64_collection.go
- int64_int64_map.go
- int64_list.go
- int64_queue.go
- int64_set.go
- int64_string_map.go
- int_collection.go
- int_int_map.go
- int_list.go
- int_queue.go
- int_set.go
- int_string_map.go
- string_any_map.go
- string_collection.go
- string_extras.go
- string_int_map.go
- string_list.go
- string_queue.go
- string_set.go
- string_string_map.go
- string_uint_map.go
- uint64_collection.go
- uint64_list.go
- uint64_queue.go
- uint64_set.go
- uint64_string_map.go
- uint64_uint64_map.go
- uint_collection.go
- uint_list.go
- uint_queue.go
- uint_set.go
- uint_string_map.go
- uint_uint_map.go
Directories
¶
Path | Synopsis |
---|---|
package immutable provides immutable collection types for core Go built-in types.
|
package immutable provides immutable collection types for core Go built-in types. |
package shared provides shareable collection types for core Go built-in types.
|
package shared provides shareable collection types for core Go built-in types. |