Documentation
¶
Overview ¶
package examples contains example collection types using a selection of the built-in templates. They are built for int and for Apple, the latter being a simple dummy struct. The types are prefixed according to their template group. These are
- 'Fast...' for the fast collections,
- 'Immutable...' for the imutable collections,
- 'Simple...' for the simple collections,
- 'Sync...' for the threadsafe collections.
In each group, there are two list types, two set types and two map types. There are also two collection types in all except the simple group.
See https://github.com/rickb777/runtemplate/blob/master/BUILTIN.md for a fuller description.
Index ¶
- func AppleBlackHole(in <-chan Apple)
- func AppleDelta(in <-chan Apple, out1, out2 chan<- Apple)
- func AppleFilter(in <-chan Apple, out chan<- Apple, p func(Apple) bool)
- func AppleFlatMap(in <-chan Apple, out chan<- Apple, fn func(Apple) AppleCollection)
- func AppleFlatMapToInt(in <-chan Apple, out chan<- int, fn func(Apple) IntCollection)
- func AppleGenerator(out chan<- Apple, iterations int, fn func(int) Apple)
- func AppleGenerator3(out chan<- Apple, from, to, stride int, fn func(int) Apple)
- func AppleMap(in <-chan Apple, out chan<- Apple, fn func(Apple) Apple)
- func AppleMapToInt(in <-chan Apple, out chan<- int, fn func(Apple) int)
- func AppleMux2(in1, in2 <-chan Apple, closer <-chan bool, out chan<- Apple)
- func ApplePartition(in <-chan Apple, matching, others chan<- Apple, p func(Apple) bool)
- func AppleZip2(in1, in2 <-chan Apple, out chan<- Apple)
- type Apple
- type AppleCollection
- type AppleList
- func (list *AppleList) Add(more ...Apple)
- func (list *AppleList) Append(more ...Apple) *AppleList
- func (list *AppleList) Clear()
- func (list *AppleList) Clone() *AppleList
- func (list *AppleList) Contains(v Apple) bool
- func (list *AppleList) ContainsAll(i ...Apple) bool
- func (list *AppleList) CountBy(p func(Apple) bool) (result int)
- func (list *AppleList) DistinctBy(equal func(Apple, Apple) bool) *AppleList
- func (list *AppleList) DoDeleteAt(index, n int) *AppleList
- func (list *AppleList) DoDeleteFirst(n int) *AppleList
- func (list *AppleList) DoDeleteLast(n int) *AppleList
- func (list *AppleList) DoInsertAt(index int, more ...Apple) *AppleList
- func (list *AppleList) DoKeepWhere(p func(Apple) bool) *AppleList
- func (list *AppleList) DoReverse() *AppleList
- func (list *AppleList) DoShuffle() *AppleList
- func (list *AppleList) Drop(n int) *AppleList
- func (list *AppleList) DropLast(n int) *AppleList
- func (list *AppleList) DropWhile(p func(Apple) bool) *AppleList
- func (list *AppleList) Equals(other *AppleList) bool
- func (list *AppleList) Exists(p func(Apple) bool) bool
- func (list *AppleList) Filter(p func(Apple) bool) *AppleList
- func (list *AppleList) Find(p func(Apple) bool) (Apple, bool)
- func (list *AppleList) FlatMap(f func(Apple) []Apple) *AppleList
- func (list *AppleList) FlatMapToString(f func(Apple) []string) []string
- func (list *AppleList) Fold(initial Apple, fn func(Apple, Apple) Apple) Apple
- func (list *AppleList) Forall(p func(Apple) bool) bool
- func (list *AppleList) Foreach(f func(Apple))
- func (list *AppleList) Get(i int) Apple
- func (list *AppleList) GobDecode(b []byte) error
- func (list AppleList) GobEncode() ([]byte, error)
- func (list *AppleList) Head() Apple
- func (list *AppleList) HeadOption() (Apple, bool)
- func (list *AppleList) IndexWhere(p func(Apple) bool) int
- func (list *AppleList) IndexWhere2(p func(Apple) bool, from int) int
- func (list *AppleList) Init() *AppleList
- func (list *AppleList) IsEmpty() bool
- func (list *AppleList) IsSequence() bool
- func (list *AppleList) IsSet() bool
- func (list *AppleList) Last() Apple
- func (list *AppleList) LastIndexWhere(p func(Apple) bool) int
- func (list *AppleList) LastIndexWhere2(p func(Apple) bool, before int) int
- func (list *AppleList) LastOption() (Apple, bool)
- func (list *AppleList) Len() int
- func (list *AppleList) Map(f func(Apple) Apple) *AppleList
- func (list *AppleList) MapToString(f func(Apple) string) []string
- func (list *AppleList) MaxBy(less func(Apple, Apple) bool) Apple
- func (list *AppleList) MinBy(less func(Apple, Apple) bool) Apple
- func (list *AppleList) NonEmpty() bool
- func (list *AppleList) Partition(p func(Apple) bool) (*AppleList, *AppleList)
- func (list *AppleList) Reverse() *AppleList
- func (list *AppleList) Send() <-chan Apple
- func (list *AppleList) Shuffle() *AppleList
- func (list *AppleList) Size() int
- func (list *AppleList) SortBy(less func(i, j Apple) bool) *AppleList
- func (list *AppleList) StableSortBy(less func(i, j Apple) bool) *AppleList
- func (list *AppleList) Swap(i, j int)
- func (list *AppleList) Tail() *AppleList
- func (list *AppleList) Take(n int) *AppleList
- func (list *AppleList) TakeLast(n int) *AppleList
- func (list *AppleList) TakeWhile(p func(Apple) bool) *AppleList
- func (list *AppleList) ToInterfaceSlice() []interface{}
- func (list *AppleList) ToList() *AppleList
- func (list *AppleList) ToSlice() []Apple
- type AppleQueue
- func (queue *AppleQueue) Add(more ...Apple)
- func (queue *AppleQueue) Cap() int
- func (queue *AppleQueue) Clear()
- func (queue *AppleQueue) Clone() *AppleQueue
- func (queue *AppleQueue) CountBy(p func(Apple) bool) (result int)
- func (queue *AppleQueue) DoKeepWhere(p func(Apple) bool) *AppleQueue
- func (queue *AppleQueue) Exists(p func(Apple) bool) bool
- func (queue *AppleQueue) Filter(p func(Apple) bool) *AppleQueue
- func (queue *AppleQueue) Find(p func(Apple) bool) (Apple, bool)
- func (queue *AppleQueue) FlatMap(f func(Apple) []Apple) *AppleQueue
- func (queue *AppleQueue) FlatMapToString(f func(Apple) []string) []string
- func (queue *AppleQueue) Fold(initial Apple, fn func(Apple, Apple) Apple) Apple
- func (queue *AppleQueue) Forall(p func(Apple) bool) bool
- func (queue *AppleQueue) Foreach(f func(Apple))
- func (queue *AppleQueue) Get(i int) Apple
- func (queue *AppleQueue) Head() Apple
- func (queue *AppleQueue) HeadOption() (Apple, bool)
- func (queue *AppleQueue) IsEmpty() bool
- func (queue *AppleQueue) IsFull() bool
- func (queue *AppleQueue) IsOverwriting() bool
- func (queue *AppleQueue) IsSequence() bool
- func (queue *AppleQueue) IsSet() bool
- func (queue *AppleQueue) Last() Apple
- func (queue *AppleQueue) LastOption() (Apple, bool)
- func (queue *AppleQueue) Len() int
- func (queue *AppleQueue) Less(i, j int) bool
- func (queue *AppleQueue) Map(f func(Apple) Apple) *AppleQueue
- func (queue *AppleQueue) MapToString(f func(Apple) string) []string
- func (queue *AppleQueue) MaxBy(less func(Apple, Apple) bool) Apple
- func (queue *AppleQueue) MinBy(less func(Apple, Apple) bool) Apple
- func (queue *AppleQueue) NonEmpty() bool
- func (queue *AppleQueue) Offer(items ...Apple) []Apple
- func (queue *AppleQueue) Partition(p func(Apple) bool) (*AppleQueue, *AppleQueue)
- func (queue *AppleQueue) Pop(n int) []Apple
- func (queue *AppleQueue) Pop1() (Apple, bool)
- func (queue *AppleQueue) Push(items ...Apple) *AppleQueue
- func (queue *AppleQueue) Reallocate(capacity int, overwrite bool) *AppleQueue
- func (queue *AppleQueue) Send() <-chan Apple
- func (queue *AppleQueue) Size() int
- func (queue *AppleQueue) Sort()
- func (queue *AppleQueue) Space() int
- func (queue *AppleQueue) StableSort()
- func (queue *AppleQueue) Swap(i, j int)
- func (queue *AppleQueue) ToInterfaceSlice() []interface{}
- func (queue *AppleQueue) ToSlice() []Apple
- type AppleSequence
- type AppleSet
- func (set *AppleSet) Add(more ...Apple)
- func (set *AppleSet) Cardinality() int
- func (set *AppleSet) Clear()
- func (set *AppleSet) Clone() *AppleSet
- func (set *AppleSet) Contains(i Apple) bool
- func (set *AppleSet) ContainsAll(i ...Apple) bool
- func (set *AppleSet) CountBy(p func(Apple) bool) (result int)
- func (set *AppleSet) Difference(other *AppleSet) *AppleSet
- func (set *AppleSet) Equals(other *AppleSet) bool
- func (set *AppleSet) Exists(p func(Apple) bool) bool
- func (set *AppleSet) Filter(p func(Apple) bool) *AppleSet
- func (set *AppleSet) Find(p func(Apple) bool) (Apple, bool)
- func (set *AppleSet) FlatMap(f func(Apple) []Apple) *AppleSet
- func (set *AppleSet) Fold(initial Apple, fn func(Apple, Apple) Apple) Apple
- func (set *AppleSet) Forall(p func(Apple) bool) bool
- func (set *AppleSet) Foreach(f func(Apple))
- func (set *AppleSet) GobDecode(b []byte) error
- func (set AppleSet) GobEncode() ([]byte, error)
- func (set *AppleSet) Intersect(other *AppleSet) *AppleSet
- func (set *AppleSet) IsEmpty() bool
- func (set *AppleSet) IsSequence() bool
- func (set *AppleSet) IsSet() bool
- func (set *AppleSet) IsSubset(other *AppleSet) bool
- func (set *AppleSet) IsSuperset(other *AppleSet) bool
- func (set *AppleSet) Map(f func(Apple) Apple) *AppleSet
- func (set *AppleSet) MaxBy(less func(Apple, Apple) bool) Apple
- func (set *AppleSet) MinBy(less func(Apple, Apple) bool) Apple
- func (set *AppleSet) NonEmpty() bool
- func (set *AppleSet) Partition(p func(Apple) bool) (*AppleSet, *AppleSet)
- func (set *AppleSet) Remove(i Apple)
- func (set *AppleSet) Send() <-chan Apple
- func (set *AppleSet) Size() int
- func (set *AppleSet) SymmetricDifference(other *AppleSet) *AppleSet
- func (set *AppleSet) ToInterfaceSlice() []interface{}
- func (set *AppleSet) ToSet() *AppleSet
- func (set *AppleSet) ToSlice() []Apple
- func (set *AppleSet) Union(other *AppleSet) *AppleSet
- type AppleSizer
- type Email
- func (email Email) MarshalText() (text []byte, err error)
- func (email Email) Ptr() *Email
- func (email *Email) Scan(value interface{}) error
- func (email Email) String() string
- func (email Email) ToLower() Email
- func (email Email) ToUpper() Email
- func (email Email) TrimSpace() Email
- func (email *Email) UnmarshalText(text []byte) error
- func (email Email) Value() (driver.Value, error)
- type EmailSlice
- type FastAppleCollection
- type FastAppleList
- func (list *FastAppleList) Add(more ...Apple)
- func (list *FastAppleList) Append(more ...Apple) *FastAppleList
- func (list *FastAppleList) Clear()
- func (list *FastAppleList) Clone() *FastAppleList
- func (list *FastAppleList) Contains(v Apple) bool
- func (list *FastAppleList) ContainsAll(i ...Apple) bool
- func (list *FastAppleList) CountBy(p func(Apple) bool) (result int)
- func (list *FastAppleList) DistinctBy(equal func(Apple, Apple) bool) *FastAppleList
- func (list *FastAppleList) DoDeleteAt(index, n int) *FastAppleList
- func (list *FastAppleList) DoDeleteFirst(n int) *FastAppleList
- func (list *FastAppleList) DoDeleteLast(n int) *FastAppleList
- func (list *FastAppleList) DoInsertAt(index int, more ...Apple) *FastAppleList
- func (list *FastAppleList) DoKeepWhere(p func(Apple) bool) *FastAppleList
- func (list *FastAppleList) DoReverse() *FastAppleList
- func (list *FastAppleList) DoShuffle() *FastAppleList
- func (list *FastAppleList) Drop(n int) *FastAppleList
- func (list *FastAppleList) DropLast(n int) *FastAppleList
- func (list *FastAppleList) DropWhile(p func(Apple) bool) *FastAppleList
- func (list *FastAppleList) Equals(other *FastAppleList) bool
- func (list *FastAppleList) Exists(p func(Apple) bool) bool
- func (list *FastAppleList) Filter(p func(Apple) bool) *FastAppleList
- func (list *FastAppleList) Find(p func(Apple) bool) (Apple, bool)
- func (list *FastAppleList) FlatMap(f func(Apple) []Apple) *FastAppleList
- func (list *FastAppleList) Fold(initial Apple, fn func(Apple, Apple) Apple) Apple
- func (list *FastAppleList) Forall(p func(Apple) bool) bool
- func (list *FastAppleList) Foreach(f func(Apple))
- func (list *FastAppleList) Get(i int) Apple
- func (list *FastAppleList) GobDecode(b []byte) error
- func (list FastAppleList) GobEncode() ([]byte, error)
- func (list *FastAppleList) Head() Apple
- func (list *FastAppleList) HeadOption() (Apple, bool)
- func (list *FastAppleList) IndexWhere(p func(Apple) bool) int
- func (list *FastAppleList) IndexWhere2(p func(Apple) bool, from int) int
- func (list *FastAppleList) Init() *FastAppleList
- func (list *FastAppleList) IsEmpty() bool
- func (list *FastAppleList) IsSequence() bool
- func (list *FastAppleList) IsSet() bool
- func (list *FastAppleList) Last() Apple
- func (list *FastAppleList) LastIndexWhere(p func(Apple) bool) int
- func (list *FastAppleList) LastIndexWhere2(p func(Apple) bool, before int) int
- func (list *FastAppleList) LastOption() (Apple, bool)
- func (list *FastAppleList) Len() int
- func (list *FastAppleList) Map(f func(Apple) Apple) *FastAppleList
- func (list *FastAppleList) MaxBy(less func(Apple, Apple) bool) Apple
- func (list *FastAppleList) MinBy(less func(Apple, Apple) bool) Apple
- func (list *FastAppleList) NonEmpty() bool
- func (list *FastAppleList) Partition(p func(Apple) bool) (*FastAppleList, *FastAppleList)
- func (list *FastAppleList) Reverse() *FastAppleList
- func (list *FastAppleList) Send() <-chan Apple
- func (list *FastAppleList) Shuffle() *FastAppleList
- func (list *FastAppleList) Size() int
- func (list *FastAppleList) SortBy(less func(i, j Apple) bool) *FastAppleList
- func (list *FastAppleList) StableSortBy(less func(i, j Apple) bool) *FastAppleList
- func (list *FastAppleList) Swap(i, j int)
- func (list *FastAppleList) Tail() *FastAppleList
- func (list *FastAppleList) Take(n int) *FastAppleList
- func (list *FastAppleList) TakeLast(n int) *FastAppleList
- func (list *FastAppleList) TakeWhile(p func(Apple) bool) *FastAppleList
- func (list *FastAppleList) ToInterfaceSlice() []interface{}
- func (list *FastAppleList) ToList() *FastAppleList
- func (list *FastAppleList) ToSlice() []Apple
- type FastAppleQueue
- func (queue *FastAppleQueue) Add(more ...Apple)
- func (queue *FastAppleQueue) Cap() int
- func (queue *FastAppleQueue) Clear()
- func (queue *FastAppleQueue) Clone() *FastAppleQueue
- func (queue *FastAppleQueue) CountBy(p func(Apple) bool) (result int)
- func (queue *FastAppleQueue) DoKeepWhere(p func(Apple) bool) *FastAppleQueue
- func (queue *FastAppleQueue) Exists(p func(Apple) bool) bool
- func (queue *FastAppleQueue) Filter(p func(Apple) bool) *FastAppleQueue
- func (queue *FastAppleQueue) Find(p func(Apple) bool) (Apple, bool)
- func (queue *FastAppleQueue) FlatMap(f func(Apple) []Apple) *FastAppleQueue
- func (queue *FastAppleQueue) Fold(initial Apple, fn func(Apple, Apple) Apple) Apple
- func (queue *FastAppleQueue) Forall(p func(Apple) bool) bool
- func (queue *FastAppleQueue) Foreach(f func(Apple))
- func (queue *FastAppleQueue) Get(i int) Apple
- func (queue *FastAppleQueue) Head() Apple
- func (queue *FastAppleQueue) HeadOption() (Apple, bool)
- func (queue *FastAppleQueue) IsEmpty() bool
- func (queue *FastAppleQueue) IsFull() bool
- func (queue *FastAppleQueue) IsOverwriting() bool
- func (queue *FastAppleQueue) IsSequence() bool
- func (queue *FastAppleQueue) IsSet() bool
- func (queue *FastAppleQueue) Last() Apple
- func (queue *FastAppleQueue) LastOption() (Apple, bool)
- func (queue *FastAppleQueue) Len() int
- func (queue *FastAppleQueue) Less(i, j int) bool
- func (queue *FastAppleQueue) Map(f func(Apple) Apple) *FastAppleQueue
- func (queue *FastAppleQueue) MaxBy(less func(Apple, Apple) bool) Apple
- func (queue *FastAppleQueue) MinBy(less func(Apple, Apple) bool) Apple
- func (queue *FastAppleQueue) NonEmpty() bool
- func (queue *FastAppleQueue) Offer(items ...Apple) []Apple
- func (queue *FastAppleQueue) Partition(p func(Apple) bool) (*FastAppleQueue, *FastAppleQueue)
- func (queue *FastAppleQueue) Pop(n int) []Apple
- func (queue *FastAppleQueue) Pop1() (Apple, bool)
- func (queue *FastAppleQueue) Push(items ...Apple) *FastAppleQueue
- func (queue *FastAppleQueue) Reallocate(capacity int, overwrite bool) *FastAppleQueue
- func (queue *FastAppleQueue) Send() <-chan Apple
- func (queue *FastAppleQueue) Size() int
- func (queue *FastAppleQueue) Sort()
- func (queue *FastAppleQueue) Space() int
- func (queue *FastAppleQueue) StableSort()
- func (queue *FastAppleQueue) Swap(i, j int)
- func (queue *FastAppleQueue) ToInterfaceSlice() []interface{}
- func (queue *FastAppleQueue) ToSlice() []Apple
- type FastAppleSequence
- type FastAppleSet
- func (set *FastAppleSet) Add(more ...Apple)
- func (set *FastAppleSet) Cardinality() int
- func (set *FastAppleSet) Clear()
- func (set *FastAppleSet) Clone() *FastAppleSet
- func (set *FastAppleSet) Contains(i Apple) bool
- func (set *FastAppleSet) ContainsAll(i ...Apple) bool
- func (set *FastAppleSet) CountBy(p func(Apple) bool) (result int)
- func (set *FastAppleSet) Difference(other *FastAppleSet) *FastAppleSet
- func (set *FastAppleSet) Equals(other *FastAppleSet) bool
- func (set *FastAppleSet) Exists(p func(Apple) bool) bool
- func (set *FastAppleSet) Filter(p func(Apple) bool) *FastAppleSet
- func (set *FastAppleSet) Find(p func(Apple) bool) (Apple, bool)
- func (set *FastAppleSet) FlatMap(f func(Apple) []Apple) *FastAppleSet
- func (set *FastAppleSet) Fold(initial Apple, fn func(Apple, Apple) Apple) Apple
- func (set *FastAppleSet) Forall(p func(Apple) bool) bool
- func (set *FastAppleSet) Foreach(f func(Apple))
- func (set *FastAppleSet) GobDecode(b []byte) error
- func (set FastAppleSet) GobEncode() ([]byte, error)
- func (set *FastAppleSet) Intersect(other *FastAppleSet) *FastAppleSet
- func (set *FastAppleSet) IsEmpty() bool
- func (set *FastAppleSet) IsSequence() bool
- func (set *FastAppleSet) IsSet() bool
- func (set *FastAppleSet) IsSubset(other *FastAppleSet) bool
- func (set *FastAppleSet) IsSuperset(other *FastAppleSet) bool
- func (set *FastAppleSet) Map(f func(Apple) Apple) *FastAppleSet
- func (set *FastAppleSet) MaxBy(less func(Apple, Apple) bool) Apple
- func (set *FastAppleSet) MinBy(less func(Apple, Apple) bool) Apple
- func (set *FastAppleSet) NonEmpty() bool
- func (set *FastAppleSet) Partition(p func(Apple) bool) (*FastAppleSet, *FastAppleSet)
- func (set *FastAppleSet) Remove(i Apple)
- func (set *FastAppleSet) Send() <-chan Apple
- func (set *FastAppleSet) Size() int
- func (set *FastAppleSet) SymmetricDifference(other *FastAppleSet) *FastAppleSet
- func (set *FastAppleSet) ToInterfaceSlice() []interface{}
- func (set *FastAppleSet) ToSet() *FastAppleSet
- func (set *FastAppleSet) ToSlice() []Apple
- func (set *FastAppleSet) Union(other *FastAppleSet) *FastAppleSet
- type FastAppleSizer
- type FastIntCollection
- type FastIntIntMap
- func (mm *FastIntIntMap) Clear()
- func (mm *FastIntIntMap) Clone() *FastIntIntMap
- func (mm *FastIntIntMap) ContainsAllKeys(kk ...int) bool
- func (mm *FastIntIntMap) ContainsKey(k int) bool
- func (mm *FastIntIntMap) DropWhere(fn func(int, int) bool) FastIntIntTuples
- func (mm *FastIntIntMap) Equals(other *FastIntIntMap) bool
- func (mm *FastIntIntMap) Exists(p func(int, int) bool) bool
- func (mm *FastIntIntMap) Filter(p func(int, int) bool) *FastIntIntMap
- func (mm *FastIntIntMap) Find(p func(int, int) bool) (FastIntIntTuple, bool)
- func (mm *FastIntIntMap) FlatMap(f func(int, int) []FastIntIntTuple) *FastIntIntMap
- func (mm *FastIntIntMap) Forall(p func(int, int) bool) bool
- func (mm *FastIntIntMap) Foreach(f func(int, int))
- func (mm *FastIntIntMap) Get(k int) (int, bool)
- func (mm *FastIntIntMap) IsEmpty() bool
- func (mm *FastIntIntMap) Keys() []int
- func (mm *FastIntIntMap) Map(f func(int, int) (int, int)) *FastIntIntMap
- func (mm *FastIntIntMap) MkString(sep string) string
- func (mm *FastIntIntMap) MkString4(before, between, after, equals string) string
- func (mm *FastIntIntMap) NonEmpty() bool
- func (mm *FastIntIntMap) OrderedSlice(keys []int) FastIntIntTuples
- func (mm *FastIntIntMap) Partition(p func(int, int) bool) (matching *FastIntIntMap, others *FastIntIntMap)
- func (mm *FastIntIntMap) Pop(k int) (int, bool)
- func (mm *FastIntIntMap) Put(k int, v int) bool
- func (mm *FastIntIntMap) Remove(k int)
- func (mm *FastIntIntMap) Size() int
- func (mm *FastIntIntMap) String() string
- func (mm *FastIntIntMap) ToSlice() FastIntIntTuples
- func (mm *FastIntIntMap) Values() []int
- type FastIntIntTuple
- type FastIntIntTuples
- func (ts FastIntIntTuples) Append1(k int, v int) FastIntIntTuples
- func (ts FastIntIntTuples) Append2(k1 int, v1 int, k2 int, v2 int) FastIntIntTuples
- func (ts FastIntIntTuples) Append3(k1 int, v1 int, k2 int, v2 int, k3 int, v3 int) FastIntIntTuples
- func (ts FastIntIntTuples) MkString(sep string) string
- func (ts FastIntIntTuples) MkString4(before, between, after, equals string) string
- func (ts FastIntIntTuples) String() string
- func (ts FastIntIntTuples) ToMap() *FastIntIntMap
- func (ts FastIntIntTuples) Values(values ...int) FastIntIntTuples
- type FastIntList
- func (list *FastIntList) Add(more ...int)
- func (list *FastIntList) Append(more ...int) *FastIntList
- func (list *FastIntList) Clear()
- func (list *FastIntList) Clone() *FastIntList
- func (list *FastIntList) Contains(v int) bool
- func (list *FastIntList) ContainsAll(i ...int) bool
- func (list *FastIntList) CountBy(p func(int) bool) (result int)
- func (list *FastIntList) DistinctBy(equal func(int, int) bool) *FastIntList
- func (list *FastIntList) DoDeleteAt(index, n int) *FastIntList
- func (list *FastIntList) DoDeleteFirst(n int) *FastIntList
- func (list *FastIntList) DoDeleteLast(n int) *FastIntList
- func (list *FastIntList) DoInsertAt(index int, more ...int) *FastIntList
- func (list *FastIntList) DoKeepWhere(p func(int) bool) *FastIntList
- func (list *FastIntList) DoReverse() *FastIntList
- func (list *FastIntList) DoShuffle() *FastIntList
- func (list *FastIntList) Drop(n int) *FastIntList
- func (list *FastIntList) DropLast(n int) *FastIntList
- func (list *FastIntList) DropWhile(p func(int) bool) *FastIntList
- func (list *FastIntList) Equals(other *FastIntList) bool
- func (list *FastIntList) Exists(p func(int) bool) bool
- func (list *FastIntList) Filter(p func(int) bool) *FastIntList
- func (list *FastIntList) Find(p func(int) bool) (int, bool)
- func (list *FastIntList) FlatMap(f func(int) []int) *FastIntList
- func (list *FastIntList) FlatMapToInt64(f func(int) []int64) []int64
- func (list *FastIntList) FlatMapToString(f func(int) []string) []string
- func (list *FastIntList) Fold(initial int, fn func(int, int) int) int
- func (list *FastIntList) Forall(p func(int) bool) bool
- func (list *FastIntList) Foreach(f func(int))
- func (list *FastIntList) Get(i int) int
- func (list *FastIntList) Head() int
- func (list *FastIntList) HeadOption() (int, bool)
- func (list *FastIntList) IndexWhere(p func(int) bool) int
- func (list *FastIntList) IndexWhere2(p func(int) bool, from int) int
- func (list *FastIntList) Init() *FastIntList
- func (list *FastIntList) IsEmpty() bool
- func (list *FastIntList) IsSequence() bool
- func (list *FastIntList) IsSet() bool
- func (list *FastIntList) Last() int
- func (list *FastIntList) LastIndexWhere(p func(int) bool) int
- func (list *FastIntList) LastIndexWhere2(p func(int) bool, before int) int
- func (list *FastIntList) LastOption() (int, bool)
- func (list *FastIntList) Len() int
- func (list *FastIntList) Map(f func(int) int) *FastIntList
- func (list *FastIntList) MapToInt64(f func(int) int64) []int64
- func (list *FastIntList) MapToString(f func(int) string) []string
- func (list FastIntList) MarshalJSON() ([]byte, error)
- func (list *FastIntList) Max() (result int)
- func (list *FastIntList) MaxBy(less func(int, int) bool) int
- func (list *FastIntList) Min() int
- func (list *FastIntList) MinBy(less func(int, int) bool) int
- func (list *FastIntList) MkString(sep string) string
- func (list *FastIntList) MkString3(before, between, after string) string
- func (list *FastIntList) NonEmpty() bool
- func (list *FastIntList) Partition(p func(int) bool) (*FastIntList, *FastIntList)
- func (list *FastIntList) Reverse() *FastIntList
- func (list *FastIntList) Send() <-chan int
- func (list *FastIntList) Shuffle() *FastIntList
- func (list *FastIntList) Size() int
- func (list *FastIntList) SortBy(less func(i, j int) bool) *FastIntList
- func (list *FastIntList) Sorted() *FastIntList
- func (list *FastIntList) StableSortBy(less func(i, j int) bool) *FastIntList
- func (list *FastIntList) StableSorted() *FastIntList
- func (list *FastIntList) String() string
- func (list *FastIntList) StringList() []string
- func (list *FastIntList) Sum() int
- func (list *FastIntList) Swap(i, j int)
- func (list *FastIntList) Tail() *FastIntList
- func (list *FastIntList) Take(n int) *FastIntList
- func (list *FastIntList) TakeLast(n int) *FastIntList
- func (list *FastIntList) TakeWhile(p func(int) bool) *FastIntList
- func (list *FastIntList) ToInterfaceSlice() []interface{}
- func (list *FastIntList) ToList() *FastIntList
- func (list *FastIntList) ToSlice() []int
- func (list *FastIntList) UnmarshalJSON(b []byte) error
- type FastIntMkStringer
- type FastIntQueue
- func (queue *FastIntQueue) Add(more ...int)
- func (queue *FastIntQueue) Cap() int
- func (queue *FastIntQueue) Clear()
- func (queue *FastIntQueue) Clone() *FastIntQueue
- func (queue *FastIntQueue) CountBy(p func(int) bool) (result int)
- func (queue *FastIntQueue) DoKeepWhere(p func(int) bool) *FastIntQueue
- func (queue *FastIntQueue) Exists(p func(int) bool) bool
- func (queue *FastIntQueue) Filter(p func(int) bool) *FastIntQueue
- func (queue *FastIntQueue) Find(p func(int) bool) (int, bool)
- func (queue *FastIntQueue) FlatMap(f func(int) []int) *FastIntQueue
- func (queue *FastIntQueue) FlatMapToInt64(f func(int) []int64) []int64
- func (queue *FastIntQueue) FlatMapToString(f func(int) []string) []string
- func (queue *FastIntQueue) Fold(initial int, fn func(int, int) int) int
- func (queue *FastIntQueue) Forall(p func(int) bool) bool
- func (queue *FastIntQueue) Foreach(f func(int))
- func (queue *FastIntQueue) Get(i int) int
- func (queue *FastIntQueue) Head() int
- func (queue *FastIntQueue) HeadOption() (int, bool)
- func (queue *FastIntQueue) IsEmpty() bool
- func (queue *FastIntQueue) IsFull() bool
- func (queue *FastIntQueue) IsOverwriting() bool
- func (queue *FastIntQueue) IsSequence() bool
- func (queue *FastIntQueue) IsSet() bool
- func (queue *FastIntQueue) Last() int
- func (queue *FastIntQueue) LastOption() (int, bool)
- func (queue *FastIntQueue) Len() int
- func (queue *FastIntQueue) Less(i, j int) bool
- func (queue *FastIntQueue) Map(f func(int) int) *FastIntQueue
- func (queue *FastIntQueue) MapToInt64(f func(int) int64) []int64
- func (queue *FastIntQueue) MapToString(f func(int) string) []string
- func (queue *FastIntQueue) MaxBy(less func(int, int) bool) int
- func (queue *FastIntQueue) MinBy(less func(int, int) bool) int
- func (queue *FastIntQueue) NonEmpty() bool
- func (queue *FastIntQueue) Offer(items ...int) []int
- func (queue *FastIntQueue) Partition(p func(int) bool) (*FastIntQueue, *FastIntQueue)
- func (queue *FastIntQueue) Pop(n int) []int
- func (queue *FastIntQueue) Pop1() (int, bool)
- func (queue *FastIntQueue) Push(items ...int) *FastIntQueue
- func (queue *FastIntQueue) Reallocate(capacity int, overwrite bool) *FastIntQueue
- func (queue *FastIntQueue) Send() <-chan int
- func (queue *FastIntQueue) Size() int
- func (queue *FastIntQueue) Sort()
- func (queue *FastIntQueue) Space() int
- func (queue *FastIntQueue) StableSort()
- func (queue *FastIntQueue) Swap(i, j int)
- func (queue *FastIntQueue) ToInterfaceSlice() []interface{}
- func (queue *FastIntQueue) ToSlice() []int
- type FastIntSequence
- type FastIntSet
- func (set *FastIntSet) Add(more ...int)
- func (set *FastIntSet) Cardinality() int
- func (set *FastIntSet) Clear()
- func (set *FastIntSet) Clone() *FastIntSet
- func (set *FastIntSet) Contains(i int) bool
- func (set *FastIntSet) ContainsAll(i ...int) bool
- func (set *FastIntSet) CountBy(p func(int) bool) (result int)
- func (set *FastIntSet) Difference(other *FastIntSet) *FastIntSet
- func (set *FastIntSet) Equals(other *FastIntSet) bool
- func (set *FastIntSet) Exists(p func(int) bool) bool
- func (set *FastIntSet) Filter(p func(int) bool) *FastIntSet
- func (set *FastIntSet) Find(p func(int) bool) (int, bool)
- func (set *FastIntSet) FlatMap(f func(int) []int) *FastIntSet
- func (set *FastIntSet) FlatMapToInt64(f func(int) []int64) []int64
- func (set *FastIntSet) FlatMapToString(f func(int) []string) []string
- func (set *FastIntSet) Fold(initial int, fn func(int, int) int) int
- func (set *FastIntSet) Forall(p func(int) bool) bool
- func (set *FastIntSet) Foreach(f func(int))
- func (set *FastIntSet) Intersect(other *FastIntSet) *FastIntSet
- func (set *FastIntSet) IsEmpty() bool
- func (set *FastIntSet) IsSequence() bool
- func (set *FastIntSet) IsSet() bool
- func (set *FastIntSet) IsSubset(other *FastIntSet) bool
- func (set *FastIntSet) IsSuperset(other *FastIntSet) bool
- func (set *FastIntSet) Map(f func(int) int) *FastIntSet
- func (set *FastIntSet) MapToInt64(f func(int) int64) []int64
- func (set *FastIntSet) MapToString(f func(int) string) []string
- func (set *FastIntSet) MarshalJSON() ([]byte, error)
- func (set *FastIntSet) Max() (result int)
- func (set *FastIntSet) MaxBy(less func(int, int) bool) int
- func (set *FastIntSet) Min() int
- func (set *FastIntSet) MinBy(less func(int, int) bool) int
- func (set *FastIntSet) MkString(sep string) string
- func (set *FastIntSet) MkString3(before, between, after string) string
- func (set *FastIntSet) NonEmpty() bool
- func (set *FastIntSet) Partition(p func(int) bool) (*FastIntSet, *FastIntSet)
- func (set *FastIntSet) Remove(i int)
- func (set *FastIntSet) Send() <-chan int
- func (set *FastIntSet) Size() int
- func (set *FastIntSet) String() string
- func (set *FastIntSet) StringList() []string
- func (set *FastIntSet) StringMap() map[string]bool
- func (set *FastIntSet) Sum() int
- func (set *FastIntSet) SymmetricDifference(other *FastIntSet) *FastIntSet
- func (set *FastIntSet) ToInterfaceSlice() []interface{}
- func (set *FastIntSet) ToSet() *FastIntSet
- func (set *FastIntSet) ToSlice() []int
- func (set *FastIntSet) Union(other *FastIntSet) *FastIntSet
- func (set *FastIntSet) UnmarshalJSON(b []byte) error
- type FastIntSizer
- type FastStringAppleMap
- func (mm *FastStringAppleMap) Clear()
- func (mm *FastStringAppleMap) Clone() *FastStringAppleMap
- func (mm *FastStringAppleMap) ContainsAllKeys(kk ...string) bool
- func (mm *FastStringAppleMap) ContainsKey(k string) bool
- func (mm *FastStringAppleMap) DropWhere(fn func(string, Apple) bool) FastStringAppleTuples
- func (mm *FastStringAppleMap) Exists(p func(string, Apple) bool) bool
- func (mm *FastStringAppleMap) Filter(p func(string, Apple) bool) *FastStringAppleMap
- func (mm *FastStringAppleMap) Find(p func(string, Apple) bool) (FastStringAppleTuple, bool)
- func (mm *FastStringAppleMap) FlatMap(f func(string, Apple) []FastStringAppleTuple) *FastStringAppleMap
- func (mm *FastStringAppleMap) Forall(p func(string, Apple) bool) bool
- func (mm *FastStringAppleMap) Foreach(f func(string, Apple))
- func (mm *FastStringAppleMap) Get(k string) (Apple, bool)
- func (mm *FastStringAppleMap) GobDecode(b []byte) error
- func (mm *FastStringAppleMap) GobEncode() ([]byte, error)
- func (mm *FastStringAppleMap) IsEmpty() bool
- func (mm *FastStringAppleMap) Keys() []string
- func (mm *FastStringAppleMap) Map(f func(string, Apple) (string, Apple)) *FastStringAppleMap
- func (mm *FastStringAppleMap) NonEmpty() bool
- func (mm *FastStringAppleMap) OrderedSlice(keys []string) FastStringAppleTuples
- func (mm *FastStringAppleMap) Partition(p func(string, Apple) bool) (matching *FastStringAppleMap, others *FastStringAppleMap)
- func (mm *FastStringAppleMap) Pop(k string) (Apple, bool)
- func (mm *FastStringAppleMap) Put(k string, v Apple) bool
- func (mm *FastStringAppleMap) Remove(k string)
- func (mm *FastStringAppleMap) Size() int
- func (mm *FastStringAppleMap) ToSlice() FastStringAppleTuples
- func (mm *FastStringAppleMap) Values() []Apple
- type FastStringAppleTuple
- type FastStringAppleTuples
- func (ts FastStringAppleTuples) Append1(k string, v Apple) FastStringAppleTuples
- func (ts FastStringAppleTuples) Append2(k1 string, v1 Apple, k2 string, v2 Apple) FastStringAppleTuples
- func (ts FastStringAppleTuples) Append3(k1 string, v1 Apple, k2 string, v2 Apple, k3 string, v3 Apple) FastStringAppleTuples
- func (ts FastStringAppleTuples) ToMap() *FastStringAppleMap
- func (ts FastStringAppleTuples) Values(values ...Apple) FastStringAppleTuples
- type FastStringList
- func (list *FastStringList) Add(more ...string)
- func (list *FastStringList) Append(more ...string) *FastStringList
- func (list *FastStringList) Clear()
- func (list *FastStringList) Clone() *FastStringList
- func (list *FastStringList) Contains(v string) bool
- func (list *FastStringList) ContainsAll(i ...string) bool
- func (list *FastStringList) CountBy(p func(string) bool) (result int)
- func (list *FastStringList) DistinctBy(equal func(string, string) bool) *FastStringList
- func (list *FastStringList) DoDeleteAt(index, n int) *FastStringList
- func (list *FastStringList) DoDeleteFirst(n int) *FastStringList
- func (list *FastStringList) DoDeleteLast(n int) *FastStringList
- func (list *FastStringList) DoInsertAt(index int, more ...string) *FastStringList
- func (list *FastStringList) DoKeepWhere(p func(string) bool) *FastStringList
- func (list *FastStringList) DoReverse() *FastStringList
- func (list *FastStringList) DoShuffle() *FastStringList
- func (list *FastStringList) Drop(n int) *FastStringList
- func (list *FastStringList) DropLast(n int) *FastStringList
- func (list *FastStringList) DropWhile(p func(string) bool) *FastStringList
- func (list *FastStringList) Equals(other *FastStringList) bool
- func (list *FastStringList) Exists(p func(string) bool) bool
- func (list *FastStringList) Filter(p func(string) bool) *FastStringList
- func (list *FastStringList) Find(p func(string) bool) (string, bool)
- func (list *FastStringList) FlatMap(f func(string) []string) *FastStringList
- func (list *FastStringList) FlatMapToInt(f func(string) []int) []int
- func (list *FastStringList) Fold(initial string, fn func(string, string) string) string
- func (list *FastStringList) Forall(p func(string) bool) bool
- func (list *FastStringList) Foreach(f func(string))
- func (list *FastStringList) Get(i int) string
- func (list *FastStringList) Head() string
- func (list *FastStringList) HeadOption() (string, bool)
- func (list *FastStringList) IndexWhere(p func(string) bool) int
- func (list *FastStringList) IndexWhere2(p func(string) bool, from int) int
- func (list *FastStringList) Init() *FastStringList
- func (list *FastStringList) IsEmpty() bool
- func (list *FastStringList) IsSequence() bool
- func (list *FastStringList) IsSet() bool
- func (list *FastStringList) Last() string
- func (list *FastStringList) LastIndexWhere(p func(string) bool) int
- func (list *FastStringList) LastIndexWhere2(p func(string) bool, before int) int
- func (list *FastStringList) LastOption() (string, bool)
- func (list *FastStringList) Len() int
- func (list *FastStringList) Map(f func(string) string) *FastStringList
- func (list *FastStringList) MapToInt(f func(string) int) []int
- func (list FastStringList) MarshalJSON() ([]byte, error)
- func (list *FastStringList) Max() (result string)
- func (list *FastStringList) MaxBy(less func(string, string) bool) string
- func (list *FastStringList) Min() string
- func (list *FastStringList) MinBy(less func(string, string) bool) string
- func (list *FastStringList) MkString(sep string) string
- func (list *FastStringList) MkString3(before, between, after string) string
- func (list *FastStringList) NonEmpty() bool
- func (list *FastStringList) Partition(p func(string) bool) (*FastStringList, *FastStringList)
- func (list *FastStringList) Reverse() *FastStringList
- func (list *FastStringList) Send() <-chan string
- func (list *FastStringList) Shuffle() *FastStringList
- func (list *FastStringList) Size() int
- func (list *FastStringList) SortBy(less func(i, j string) bool) *FastStringList
- func (list *FastStringList) Sorted() *FastStringList
- func (list *FastStringList) StableSortBy(less func(i, j string) bool) *FastStringList
- func (list *FastStringList) StableSorted() *FastStringList
- func (list *FastStringList) String() string
- func (list *FastStringList) StringList() []string
- func (list *FastStringList) Swap(i, j int)
- func (list *FastStringList) Tail() *FastStringList
- func (list *FastStringList) Take(n int) *FastStringList
- func (list *FastStringList) TakeLast(n int) *FastStringList
- func (list *FastStringList) TakeWhile(p func(string) bool) *FastStringList
- func (list *FastStringList) ToInterfaceSlice() []interface{}
- func (list *FastStringList) ToList() *FastStringList
- func (list *FastStringList) ToSlice() []string
- func (list *FastStringList) UnmarshalJSON(b []byte) error
- type ImmutableAppleCollection
- type ImmutableAppleList
- func (list *ImmutableAppleList) Append(more ...Apple) *ImmutableAppleList
- func (list *ImmutableAppleList) Clone() *ImmutableAppleList
- func (list *ImmutableAppleList) CountBy(p func(Apple) bool) (result int)
- func (list *ImmutableAppleList) DistinctBy(equal func(Apple, Apple) bool) *ImmutableAppleList
- func (list *ImmutableAppleList) Drop(n int) *ImmutableAppleList
- func (list *ImmutableAppleList) DropLast(n int) *ImmutableAppleList
- func (list *ImmutableAppleList) DropWhile(p func(Apple) bool) *ImmutableAppleList
- func (list *ImmutableAppleList) Exists(p func(Apple) bool) bool
- func (list *ImmutableAppleList) Filter(p func(Apple) bool) *ImmutableAppleList
- func (list *ImmutableAppleList) Find(p func(Apple) bool) (Apple, bool)
- func (list *ImmutableAppleList) FlatMap(f func(Apple) []Apple) *ImmutableAppleList
- func (list *ImmutableAppleList) FlatMapToString(f func(Apple) []string) []string
- func (list *ImmutableAppleList) Fold(initial Apple, fn func(Apple, Apple) Apple) Apple
- func (list *ImmutableAppleList) Forall(p func(Apple) bool) bool
- func (list *ImmutableAppleList) Foreach(f func(Apple))
- func (list *ImmutableAppleList) Get(i int) Apple
- func (list *ImmutableAppleList) GobDecode(b []byte) error
- func (list ImmutableAppleList) GobEncode() ([]byte, error)
- func (list *ImmutableAppleList) Head() Apple
- func (list *ImmutableAppleList) HeadOption() (Apple, bool)
- func (list *ImmutableAppleList) IndexWhere(p func(Apple) bool) int
- func (list *ImmutableAppleList) IndexWhere2(p func(Apple) bool, from int) int
- func (list *ImmutableAppleList) Init() *ImmutableAppleList
- func (list *ImmutableAppleList) IsEmpty() bool
- func (list *ImmutableAppleList) IsSequence() bool
- func (list *ImmutableAppleList) IsSet() bool
- func (list *ImmutableAppleList) Last() Apple
- func (list *ImmutableAppleList) LastIndexWhere(p func(Apple) bool) int
- func (list *ImmutableAppleList) LastIndexWhere2(p func(Apple) bool, before int) int
- func (list *ImmutableAppleList) LastOption() (Apple, bool)
- func (list *ImmutableAppleList) Len() int
- func (list *ImmutableAppleList) Map(f func(Apple) Apple) *ImmutableAppleList
- func (list *ImmutableAppleList) MapToString(f func(Apple) string) []string
- func (list *ImmutableAppleList) MaxBy(less func(Apple, Apple) bool) Apple
- func (list *ImmutableAppleList) MinBy(less func(Apple, Apple) bool) Apple
- func (list *ImmutableAppleList) NonEmpty() bool
- func (list *ImmutableAppleList) Partition(p func(Apple) bool) (*ImmutableAppleList, *ImmutableAppleList)
- func (list *ImmutableAppleList) Reverse() *ImmutableAppleList
- func (list *ImmutableAppleList) Send() <-chan Apple
- func (list *ImmutableAppleList) Shuffle() *ImmutableAppleList
- func (list *ImmutableAppleList) Size() int
- func (list *ImmutableAppleList) SortBy(less func(i, j Apple) bool) *ImmutableAppleList
- func (list *ImmutableAppleList) StableSortBy(less func(i, j Apple) bool) *ImmutableAppleList
- func (list *ImmutableAppleList) Tail() *ImmutableAppleList
- func (list *ImmutableAppleList) Take(n int) *ImmutableAppleList
- func (list *ImmutableAppleList) TakeLast(n int) *ImmutableAppleList
- func (list *ImmutableAppleList) TakeWhile(p func(Apple) bool) *ImmutableAppleList
- func (list *ImmutableAppleList) ToInterfaceSlice() []interface{}
- func (list *ImmutableAppleList) ToList() *ImmutableAppleList
- func (list *ImmutableAppleList) ToSlice() []Apple
- type ImmutableAppleSequence
- type ImmutableAppleSet
- func (set *ImmutableAppleSet) Add(more ...Apple) *ImmutableAppleSet
- func (set *ImmutableAppleSet) Cardinality() int
- func (set *ImmutableAppleSet) Clone() *ImmutableAppleSet
- func (set *ImmutableAppleSet) Contains(i Apple) bool
- func (set *ImmutableAppleSet) ContainsAll(i ...Apple) bool
- func (set *ImmutableAppleSet) CountBy(p func(Apple) bool) (result int)
- func (set *ImmutableAppleSet) Difference(other *ImmutableAppleSet) *ImmutableAppleSet
- func (set *ImmutableAppleSet) Equals(other *ImmutableAppleSet) bool
- func (set *ImmutableAppleSet) Exists(p func(Apple) bool) bool
- func (set *ImmutableAppleSet) Filter(p func(Apple) bool) *ImmutableAppleSet
- func (set *ImmutableAppleSet) Find(p func(Apple) bool) (Apple, bool)
- func (set *ImmutableAppleSet) FlatMap(f func(Apple) []Apple) *ImmutableAppleSet
- func (set *ImmutableAppleSet) FlatMapToString(f func(Apple) []string) []string
- func (set *ImmutableAppleSet) Fold(initial Apple, fn func(Apple, Apple) Apple) Apple
- func (set *ImmutableAppleSet) Forall(p func(Apple) bool) bool
- func (set *ImmutableAppleSet) Foreach(f func(Apple))
- func (set *ImmutableAppleSet) GobDecode(b []byte) error
- func (set ImmutableAppleSet) GobEncode() ([]byte, error)
- func (set *ImmutableAppleSet) Intersect(other *ImmutableAppleSet) *ImmutableAppleSet
- func (set *ImmutableAppleSet) IsEmpty() bool
- func (set *ImmutableAppleSet) IsSequence() bool
- func (set *ImmutableAppleSet) IsSet() bool
- func (set *ImmutableAppleSet) IsSubset(other *ImmutableAppleSet) bool
- func (set *ImmutableAppleSet) IsSuperset(other *ImmutableAppleSet) bool
- func (set *ImmutableAppleSet) Map(f func(Apple) Apple) *ImmutableAppleSet
- func (set *ImmutableAppleSet) MapToString(f func(Apple) string) []string
- func (set *ImmutableAppleSet) MaxBy(less func(Apple, Apple) bool) Apple
- func (set *ImmutableAppleSet) MinBy(less func(Apple, Apple) bool) Apple
- func (set *ImmutableAppleSet) NonEmpty() bool
- func (set *ImmutableAppleSet) Partition(p func(Apple) bool) (*ImmutableAppleSet, *ImmutableAppleSet)
- func (set *ImmutableAppleSet) Remove(i Apple) *ImmutableAppleSet
- func (set *ImmutableAppleSet) Send() <-chan Apple
- func (set *ImmutableAppleSet) Size() int
- func (set *ImmutableAppleSet) SymmetricDifference(other *ImmutableAppleSet) *ImmutableAppleSet
- func (set *ImmutableAppleSet) ToInterfaceSlice() []interface{}
- func (set *ImmutableAppleSet) ToSet() *ImmutableAppleSet
- func (set *ImmutableAppleSet) ToSlice() []Apple
- func (set *ImmutableAppleSet) Union(other *ImmutableAppleSet) *ImmutableAppleSet
- type ImmutableAppleSizer
- type ImmutableIntCollection
- type ImmutableIntIntMap
- func (mm *ImmutableIntIntMap) Clone() *ImmutableIntIntMap
- func (mm *ImmutableIntIntMap) ContainsAllKeys(kk ...int) bool
- func (mm *ImmutableIntIntMap) ContainsKey(k int) bool
- func (mm *ImmutableIntIntMap) Equals(other *ImmutableIntIntMap) bool
- func (mm *ImmutableIntIntMap) Exists(p func(int, int) bool) bool
- func (mm *ImmutableIntIntMap) Filter(p func(int, int) bool) *ImmutableIntIntMap
- func (mm *ImmutableIntIntMap) Find(p func(int, int) bool) (ImmutableIntIntTuple, bool)
- func (mm *ImmutableIntIntMap) FlatMap(f func(int, int) []ImmutableIntIntTuple) *ImmutableIntIntMap
- func (mm *ImmutableIntIntMap) Forall(f func(int, int) bool) bool
- func (mm *ImmutableIntIntMap) Foreach(f func(int, int))
- func (mm *ImmutableIntIntMap) Get(k int) (int, bool)
- func (mm *ImmutableIntIntMap) IsEmpty() bool
- func (mm *ImmutableIntIntMap) Keys() []int
- func (mm *ImmutableIntIntMap) Map(f func(int, int) (int, int)) *ImmutableIntIntMap
- func (mm *ImmutableIntIntMap) MkString(sep string) string
- func (mm *ImmutableIntIntMap) MkString4(before, between, after, equals string) string
- func (mm *ImmutableIntIntMap) NonEmpty() bool
- func (mm *ImmutableIntIntMap) OrderedSlice(keys []int) ImmutableIntIntTuples
- func (mm *ImmutableIntIntMap) Partition(p func(int, int) bool) (matching *ImmutableIntIntMap, others *ImmutableIntIntMap)
- func (mm *ImmutableIntIntMap) Put(k int, v int) *ImmutableIntIntMap
- func (mm *ImmutableIntIntMap) Size() int
- func (mm *ImmutableIntIntMap) String() string
- func (mm *ImmutableIntIntMap) ToSlice() ImmutableIntIntTuples
- func (mm *ImmutableIntIntMap) Values() []int
- type ImmutableIntIntTuple
- type ImmutableIntIntTuples
- func (ts ImmutableIntIntTuples) Append1(k int, v int) ImmutableIntIntTuples
- func (ts ImmutableIntIntTuples) Append2(k1 int, v1 int, k2 int, v2 int) ImmutableIntIntTuples
- func (ts ImmutableIntIntTuples) Append3(k1 int, v1 int, k2 int, v2 int, k3 int, v3 int) ImmutableIntIntTuples
- func (ts ImmutableIntIntTuples) MkString(sep string) string
- func (ts ImmutableIntIntTuples) MkString4(before, between, after, equals string) string
- func (ts ImmutableIntIntTuples) String() string
- func (ts ImmutableIntIntTuples) ToMap() *ImmutableIntIntMap
- func (ts ImmutableIntIntTuples) Values(values ...int) ImmutableIntIntTuples
- type ImmutableIntList
- func (list *ImmutableIntList) Append(more ...int) *ImmutableIntList
- func (list *ImmutableIntList) Clone() *ImmutableIntList
- func (list *ImmutableIntList) Contains(v int) bool
- func (list *ImmutableIntList) ContainsAll(i ...int) bool
- func (list *ImmutableIntList) CountBy(p func(int) bool) (result int)
- func (list *ImmutableIntList) DistinctBy(equal func(int, int) bool) *ImmutableIntList
- func (list *ImmutableIntList) Drop(n int) *ImmutableIntList
- func (list *ImmutableIntList) DropLast(n int) *ImmutableIntList
- func (list *ImmutableIntList) DropWhile(p func(int) bool) *ImmutableIntList
- func (list *ImmutableIntList) Equals(other *ImmutableIntList) bool
- func (list *ImmutableIntList) Exists(p func(int) bool) bool
- func (list *ImmutableIntList) Filter(p func(int) bool) *ImmutableIntList
- func (list *ImmutableIntList) Find(p func(int) bool) (int, bool)
- func (list *ImmutableIntList) FlatMap(f func(int) []int) *ImmutableIntList
- func (list *ImmutableIntList) FlatMapToInt64(f func(int) []int64) []int64
- func (list *ImmutableIntList) FlatMapToString(f func(int) []string) []string
- func (list *ImmutableIntList) Fold(initial int, fn func(int, int) int) int
- func (list *ImmutableIntList) Forall(p func(int) bool) bool
- func (list *ImmutableIntList) Foreach(f func(int))
- func (list *ImmutableIntList) Get(i int) int
- func (list *ImmutableIntList) Head() int
- func (list *ImmutableIntList) HeadOption() (int, bool)
- func (list *ImmutableIntList) IndexWhere(p func(int) bool) int
- func (list *ImmutableIntList) IndexWhere2(p func(int) bool, from int) int
- func (list *ImmutableIntList) Init() *ImmutableIntList
- func (list *ImmutableIntList) IsEmpty() bool
- func (list *ImmutableIntList) IsSequence() bool
- func (list *ImmutableIntList) IsSet() bool
- func (list *ImmutableIntList) Last() int
- func (list *ImmutableIntList) LastIndexWhere(p func(int) bool) int
- func (list *ImmutableIntList) LastIndexWhere2(p func(int) bool, before int) int
- func (list *ImmutableIntList) LastOption() (int, bool)
- func (list *ImmutableIntList) Len() int
- func (list *ImmutableIntList) Map(f func(int) int) *ImmutableIntList
- func (list *ImmutableIntList) MapToInt64(f func(int) int64) []int64
- func (list *ImmutableIntList) MapToString(f func(int) string) []string
- func (list ImmutableIntList) MarshalJSON() ([]byte, error)
- func (list *ImmutableIntList) Max() (result int)
- func (list *ImmutableIntList) MaxBy(less func(int, int) bool) int
- func (list *ImmutableIntList) Min() int
- func (list *ImmutableIntList) MinBy(less func(int, int) bool) int
- func (list *ImmutableIntList) MkString(sep string) string
- func (list *ImmutableIntList) MkString3(before, between, after string) string
- func (list *ImmutableIntList) NonEmpty() bool
- func (list *ImmutableIntList) Partition(p func(int) bool) (*ImmutableIntList, *ImmutableIntList)
- func (list *ImmutableIntList) Reverse() *ImmutableIntList
- func (list *ImmutableIntList) Send() <-chan int
- func (list *ImmutableIntList) Shuffle() *ImmutableIntList
- func (list *ImmutableIntList) Size() int
- func (list *ImmutableIntList) SortBy(less func(i, j int) bool) *ImmutableIntList
- func (list *ImmutableIntList) Sorted() *ImmutableIntList
- func (list *ImmutableIntList) StableSortBy(less func(i, j int) bool) *ImmutableIntList
- func (list *ImmutableIntList) StableSorted() *ImmutableIntList
- func (list *ImmutableIntList) String() string
- func (list *ImmutableIntList) StringList() []string
- func (list *ImmutableIntList) Sum() int
- func (list *ImmutableIntList) Tail() *ImmutableIntList
- func (list *ImmutableIntList) Take(n int) *ImmutableIntList
- func (list *ImmutableIntList) TakeLast(n int) *ImmutableIntList
- func (list *ImmutableIntList) TakeWhile(p func(int) bool) *ImmutableIntList
- func (list *ImmutableIntList) ToInterfaceSlice() []interface{}
- func (list *ImmutableIntList) ToList() *ImmutableIntList
- func (list *ImmutableIntList) ToSlice() []int
- func (list *ImmutableIntList) UnmarshalJSON(b []byte) error
- type ImmutableIntMkStringer
- type ImmutableIntSequence
- type ImmutableIntSet
- func (set *ImmutableIntSet) Add(more ...int) *ImmutableIntSet
- func (set *ImmutableIntSet) Cardinality() int
- func (set *ImmutableIntSet) Clone() *ImmutableIntSet
- func (set *ImmutableIntSet) Contains(i int) bool
- func (set *ImmutableIntSet) ContainsAll(i ...int) bool
- func (set *ImmutableIntSet) CountBy(p func(int) bool) (result int)
- func (set *ImmutableIntSet) Difference(other *ImmutableIntSet) *ImmutableIntSet
- func (set *ImmutableIntSet) Equals(other *ImmutableIntSet) bool
- func (set *ImmutableIntSet) Exists(p func(int) bool) bool
- func (set *ImmutableIntSet) Filter(p func(int) bool) *ImmutableIntSet
- func (set *ImmutableIntSet) Find(p func(int) bool) (int, bool)
- func (set *ImmutableIntSet) FlatMap(f func(int) []int) *ImmutableIntSet
- func (set *ImmutableIntSet) FlatMapToInt64(f func(int) []int64) []int64
- func (set *ImmutableIntSet) FlatMapToString(f func(int) []string) []string
- func (set *ImmutableIntSet) Fold(initial int, fn func(int, int) int) int
- func (set *ImmutableIntSet) Forall(p func(int) bool) bool
- func (set *ImmutableIntSet) Foreach(f func(int))
- func (set *ImmutableIntSet) Intersect(other *ImmutableIntSet) *ImmutableIntSet
- func (set *ImmutableIntSet) IsEmpty() bool
- func (set *ImmutableIntSet) IsSequence() bool
- func (set *ImmutableIntSet) IsSet() bool
- func (set *ImmutableIntSet) IsSubset(other *ImmutableIntSet) bool
- func (set *ImmutableIntSet) IsSuperset(other *ImmutableIntSet) bool
- func (set *ImmutableIntSet) Map(f func(int) int) *ImmutableIntSet
- func (set *ImmutableIntSet) MapToInt64(f func(int) int64) []int64
- func (set *ImmutableIntSet) MapToString(f func(int) string) []string
- func (set *ImmutableIntSet) MarshalJSON() ([]byte, error)
- func (set *ImmutableIntSet) Max() (result int)
- func (set *ImmutableIntSet) MaxBy(less func(int, int) bool) int
- func (set *ImmutableIntSet) Min() int
- func (set *ImmutableIntSet) MinBy(less func(int, int) bool) int
- func (set *ImmutableIntSet) MkString(sep string) string
- func (set *ImmutableIntSet) MkString3(before, between, after string) string
- func (set *ImmutableIntSet) NonEmpty() bool
- func (set *ImmutableIntSet) Partition(p func(int) bool) (*ImmutableIntSet, *ImmutableIntSet)
- func (set *ImmutableIntSet) Remove(i int) *ImmutableIntSet
- func (set *ImmutableIntSet) Send() <-chan int
- func (set *ImmutableIntSet) Size() int
- func (set *ImmutableIntSet) String() string
- func (set *ImmutableIntSet) StringList() []string
- func (set *ImmutableIntSet) StringMap() map[string]bool
- func (set *ImmutableIntSet) Sum() int
- func (set *ImmutableIntSet) SymmetricDifference(other *ImmutableIntSet) *ImmutableIntSet
- func (set *ImmutableIntSet) ToInterfaceSlice() []interface{}
- func (set *ImmutableIntSet) ToSet() *ImmutableIntSet
- func (set *ImmutableIntSet) ToSlice() []int
- func (set *ImmutableIntSet) Union(other *ImmutableIntSet) *ImmutableIntSet
- func (set *ImmutableIntSet) UnmarshalJSON(b []byte) error
- type ImmutableIntSizer
- type ImmutableStringAppleMap
- func (mm *ImmutableStringAppleMap) Clone() *ImmutableStringAppleMap
- func (mm *ImmutableStringAppleMap) ContainsAllKeys(kk ...string) bool
- func (mm *ImmutableStringAppleMap) ContainsKey(k string) bool
- func (mm *ImmutableStringAppleMap) Exists(p func(string, Apple) bool) bool
- func (mm *ImmutableStringAppleMap) Filter(p func(string, Apple) bool) *ImmutableStringAppleMap
- func (mm *ImmutableStringAppleMap) Find(p func(string, Apple) bool) (ImmutableStringAppleTuple, bool)
- func (mm *ImmutableStringAppleMap) FlatMap(f func(string, Apple) []ImmutableStringAppleTuple) *ImmutableStringAppleMap
- func (mm *ImmutableStringAppleMap) Forall(f func(string, Apple) bool) bool
- func (mm *ImmutableStringAppleMap) Foreach(f func(string, Apple))
- func (mm *ImmutableStringAppleMap) Get(k string) (Apple, bool)
- func (mm *ImmutableStringAppleMap) GobDecode(b []byte) error
- func (mm *ImmutableStringAppleMap) GobEncode() ([]byte, error)
- func (mm *ImmutableStringAppleMap) IsEmpty() bool
- func (mm *ImmutableStringAppleMap) Keys() []string
- func (mm *ImmutableStringAppleMap) Map(f func(string, Apple) (string, Apple)) *ImmutableStringAppleMap
- func (mm *ImmutableStringAppleMap) NonEmpty() bool
- func (mm *ImmutableStringAppleMap) OrderedSlice(keys []string) ImmutableStringAppleTuples
- func (mm *ImmutableStringAppleMap) Partition(p func(string, Apple) bool) (matching *ImmutableStringAppleMap, others *ImmutableStringAppleMap)
- func (mm *ImmutableStringAppleMap) Put(k string, v Apple) *ImmutableStringAppleMap
- func (mm *ImmutableStringAppleMap) Size() int
- func (mm *ImmutableStringAppleMap) ToSlice() ImmutableStringAppleTuples
- func (mm *ImmutableStringAppleMap) Values() []Apple
- type ImmutableStringAppleTuple
- type ImmutableStringAppleTuples
- func (ts ImmutableStringAppleTuples) Append1(k string, v Apple) ImmutableStringAppleTuples
- func (ts ImmutableStringAppleTuples) Append2(k1 string, v1 Apple, k2 string, v2 Apple) ImmutableStringAppleTuples
- func (ts ImmutableStringAppleTuples) Append3(k1 string, v1 Apple, k2 string, v2 Apple, k3 string, v3 Apple) ImmutableStringAppleTuples
- func (ts ImmutableStringAppleTuples) ToMap() *ImmutableStringAppleMap
- func (ts ImmutableStringAppleTuples) Values(values ...Apple) ImmutableStringAppleTuples
- type ImmutableStringList
- func (list *ImmutableStringList) Append(more ...string) *ImmutableStringList
- func (list *ImmutableStringList) Clone() *ImmutableStringList
- func (list *ImmutableStringList) Contains(v string) bool
- func (list *ImmutableStringList) ContainsAll(i ...string) bool
- func (list *ImmutableStringList) CountBy(p func(string) bool) (result int)
- func (list *ImmutableStringList) DistinctBy(equal func(string, string) bool) *ImmutableStringList
- func (list *ImmutableStringList) Drop(n int) *ImmutableStringList
- func (list *ImmutableStringList) DropLast(n int) *ImmutableStringList
- func (list *ImmutableStringList) DropWhile(p func(string) bool) *ImmutableStringList
- func (list *ImmutableStringList) Equals(other *ImmutableStringList) bool
- func (list *ImmutableStringList) Exists(p func(string) bool) bool
- func (list *ImmutableStringList) Filter(p func(string) bool) *ImmutableStringList
- func (list *ImmutableStringList) Find(p func(string) bool) (string, bool)
- func (list *ImmutableStringList) FlatMap(f func(string) []string) *ImmutableStringList
- func (list *ImmutableStringList) FlatMapToInt(f func(string) []int) []int
- func (list *ImmutableStringList) Fold(initial string, fn func(string, string) string) string
- func (list *ImmutableStringList) Forall(p func(string) bool) bool
- func (list *ImmutableStringList) Foreach(f func(string))
- func (list *ImmutableStringList) Get(i int) string
- func (list *ImmutableStringList) Head() string
- func (list *ImmutableStringList) HeadOption() (string, bool)
- func (list *ImmutableStringList) IndexWhere(p func(string) bool) int
- func (list *ImmutableStringList) IndexWhere2(p func(string) bool, from int) int
- func (list *ImmutableStringList) Init() *ImmutableStringList
- func (list *ImmutableStringList) IsEmpty() bool
- func (list *ImmutableStringList) IsSequence() bool
- func (list *ImmutableStringList) IsSet() bool
- func (list *ImmutableStringList) Last() string
- func (list *ImmutableStringList) LastIndexWhere(p func(string) bool) int
- func (list *ImmutableStringList) LastIndexWhere2(p func(string) bool, before int) int
- func (list *ImmutableStringList) LastOption() (string, bool)
- func (list *ImmutableStringList) Len() int
- func (list *ImmutableStringList) Map(f func(string) string) *ImmutableStringList
- func (list *ImmutableStringList) MapToInt(f func(string) int) []int
- func (list ImmutableStringList) MarshalJSON() ([]byte, error)
- func (list *ImmutableStringList) Max() (result string)
- func (list *ImmutableStringList) MaxBy(less func(string, string) bool) string
- func (list *ImmutableStringList) Min() string
- func (list *ImmutableStringList) MinBy(less func(string, string) bool) string
- func (list *ImmutableStringList) MkString(sep string) string
- func (list *ImmutableStringList) MkString3(before, between, after string) string
- func (list *ImmutableStringList) NonEmpty() bool
- func (list *ImmutableStringList) Partition(p func(string) bool) (*ImmutableStringList, *ImmutableStringList)
- func (list *ImmutableStringList) Reverse() *ImmutableStringList
- func (list *ImmutableStringList) Send() <-chan string
- func (list *ImmutableStringList) Shuffle() *ImmutableStringList
- func (list *ImmutableStringList) Size() int
- func (list *ImmutableStringList) SortBy(less func(i, j string) bool) *ImmutableStringList
- func (list *ImmutableStringList) Sorted() *ImmutableStringList
- func (list *ImmutableStringList) StableSortBy(less func(i, j string) bool) *ImmutableStringList
- func (list *ImmutableStringList) StableSorted() *ImmutableStringList
- func (list *ImmutableStringList) String() string
- func (list *ImmutableStringList) StringList() []string
- func (list *ImmutableStringList) Tail() *ImmutableStringList
- func (list *ImmutableStringList) Take(n int) *ImmutableStringList
- func (list *ImmutableStringList) TakeLast(n int) *ImmutableStringList
- func (list *ImmutableStringList) TakeWhile(p func(string) bool) *ImmutableStringList
- func (list *ImmutableStringList) ToInterfaceSlice() []interface{}
- func (list *ImmutableStringList) ToList() *ImmutableStringList
- func (list *ImmutableStringList) ToSlice() []string
- func (list *ImmutableStringList) UnmarshalJSON(b []byte) error
- 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) GobDecode(b []byte) error
- func (mm *IntIntMap) GobEncode() ([]byte, error)
- func (mm *IntIntMap) IsEmpty() bool
- func (mm *IntIntMap) Keys() []int
- 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 []int) 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() []int
- 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) Add(more ...int)
- func (list *IntList) Append(more ...int) *IntList
- func (list *IntList) Clear()
- 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) DoDeleteAt(index, n int) *IntList
- func (list *IntList) DoDeleteFirst(n int) *IntList
- func (list *IntList) DoDeleteLast(n int) *IntList
- func (list *IntList) DoInsertAt(index int, more ...int) *IntList
- func (list *IntList) DoKeepWhere(p func(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) FlatMapToInt64(f func(int) []int64) []int64
- 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) 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) MapToInt64(f func(int) int64) []int64
- func (list *IntList) MapToString(f func(int) string) []string
- func (list IntList) MarshalJSON() ([]byte, error)
- 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) ToSlice() []int
- func (list *IntList) UnmarshalJSON(b []byte) error
- 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) CountBy(p func(int) bool) (result int)
- func (queue *IntQueue) DoKeepWhere(p func(int) bool) *IntQueue
- 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) FlatMapToInt64(f func(int) []int64) []int64
- 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) MapToInt64(f func(int) int64) []int64
- func (queue *IntQueue) MapToString(f func(int) string) []string
- func (queue *IntQueue) MaxBy(less func(int, int) bool) int
- func (queue *IntQueue) MinBy(less func(int, int) bool) int
- 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) Swap(i, j int)
- func (queue *IntQueue) ToInterfaceSlice() []interface{}
- func (queue *IntQueue) ToSlice() []int
- type IntSequence
- type IntSet
- func (set *IntSet) Add(more ...int)
- 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) FlatMapToInt64(f func(int) []int64) []int64
- 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) MapToInt64(f func(int) int64) []int64
- func (set *IntSet) MapToString(f func(int) string) []string
- func (set *IntSet) MarshalJSON() ([]byte, error)
- func (set *IntSet) Max() (result 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) ToSet() *IntSet
- func (set *IntSet) ToSlice() []int
- func (set *IntSet) Union(other *IntSet) *IntSet
- func (set *IntSet) UnmarshalJSON(b []byte) error
- type IntSizer
- type SimpleAppleList
- func (list SimpleAppleList) Clone() SimpleAppleList
- func (list SimpleAppleList) Contains(v Apple) bool
- func (list SimpleAppleList) ContainsAll(i ...Apple) bool
- func (list SimpleAppleList) CountBy(p func(Apple) bool) (result int)
- func (list SimpleAppleList) DistinctBy(equal func(Apple, Apple) bool) SimpleAppleList
- func (list SimpleAppleList) DoReverse() SimpleAppleList
- func (list SimpleAppleList) DoShuffle() SimpleAppleList
- func (list SimpleAppleList) Drop(n int) SimpleAppleList
- func (list SimpleAppleList) DropLast(n int) SimpleAppleList
- func (list SimpleAppleList) DropWhile(p func(Apple) bool) SimpleAppleList
- func (list SimpleAppleList) Equals(other SimpleAppleList) bool
- func (list SimpleAppleList) Exists(p func(Apple) bool) bool
- func (list SimpleAppleList) Filter(p func(Apple) bool) SimpleAppleList
- func (list SimpleAppleList) Find(p func(Apple) bool) (Apple, bool)
- func (list SimpleAppleList) FlatMap(f func(Apple) []Apple) SimpleAppleList
- func (list SimpleAppleList) FlatMapToString(f func(Apple) []string) []string
- func (list SimpleAppleList) Fold(initial Apple, fn func(Apple, Apple) Apple) Apple
- func (list SimpleAppleList) Forall(p func(Apple) bool) bool
- func (list SimpleAppleList) Foreach(f func(Apple))
- func (list SimpleAppleList) Get(i int) Apple
- func (list SimpleAppleList) Head() Apple
- func (list SimpleAppleList) HeadOption() (Apple, bool)
- func (list SimpleAppleList) IndexWhere(p func(Apple) bool) int
- func (list SimpleAppleList) IndexWhere2(p func(Apple) bool, from int) int
- func (list SimpleAppleList) Init() SimpleAppleList
- func (list SimpleAppleList) IsEmpty() bool
- func (list SimpleAppleList) IsSequence() bool
- func (list SimpleAppleList) IsSet() bool
- func (list SimpleAppleList) Last() Apple
- func (list SimpleAppleList) LastIndexWhere(p func(Apple) bool) int
- func (list SimpleAppleList) LastIndexWhere2(p func(Apple) bool, before int) int
- func (list SimpleAppleList) LastOption() (Apple, bool)
- func (list SimpleAppleList) Len() int
- func (list SimpleAppleList) Map(f func(Apple) Apple) SimpleAppleList
- func (list SimpleAppleList) MapToString(f func(Apple) string) []string
- func (list SimpleAppleList) MaxBy(less func(Apple, Apple) bool) Apple
- func (list SimpleAppleList) MinBy(less func(Apple, Apple) bool) Apple
- func (list SimpleAppleList) NonEmpty() bool
- func (list SimpleAppleList) Partition(p func(Apple) bool) (SimpleAppleList, SimpleAppleList)
- func (list SimpleAppleList) Reverse() SimpleAppleList
- func (list SimpleAppleList) Send() <-chan Apple
- func (list SimpleAppleList) Shuffle() SimpleAppleList
- func (list SimpleAppleList) Size() int
- func (list SimpleAppleList) SortBy(less func(i, j Apple) bool) SimpleAppleList
- func (list SimpleAppleList) StableSortBy(less func(i, j Apple) bool) SimpleAppleList
- func (list SimpleAppleList) Swap(i, j int)
- func (list SimpleAppleList) Tail() SimpleAppleList
- func (list SimpleAppleList) Take(n int) SimpleAppleList
- func (list SimpleAppleList) TakeLast(n int) SimpleAppleList
- func (list SimpleAppleList) TakeWhile(p func(Apple) bool) SimpleAppleList
- func (list SimpleAppleList) ToInterfaceSlice() []interface{}
- func (list SimpleAppleList) ToList() SimpleAppleList
- func (list SimpleAppleList) ToSlice() []Apple
- type SimpleAppleSet
- func (set SimpleAppleSet) Add(more ...Apple) SimpleAppleSet
- func (set SimpleAppleSet) Append(more ...Apple) SimpleAppleSet
- func (set SimpleAppleSet) Cardinality() int
- func (set *SimpleAppleSet) Clear()
- func (set SimpleAppleSet) Clone() SimpleAppleSet
- func (set SimpleAppleSet) Contains(i Apple) bool
- func (set SimpleAppleSet) ContainsAll(i ...Apple) bool
- func (set SimpleAppleSet) CountBy(p func(Apple) bool) (result int)
- func (set SimpleAppleSet) Difference(other SimpleAppleSet) SimpleAppleSet
- func (set SimpleAppleSet) Equals(other SimpleAppleSet) bool
- func (set SimpleAppleSet) Exists(p func(Apple) bool) bool
- func (set SimpleAppleSet) Filter(p func(Apple) bool) SimpleAppleSet
- func (set SimpleAppleSet) Find(p func(Apple) bool) (Apple, bool)
- func (set SimpleAppleSet) FlatMap(f func(Apple) []Apple) SimpleAppleSet
- func (set SimpleAppleSet) FlatMapToString(f func(Apple) []string) []string
- func (set SimpleAppleSet) Fold(initial Apple, fn func(Apple, Apple) Apple) Apple
- func (set SimpleAppleSet) Forall(p func(Apple) bool) bool
- func (set SimpleAppleSet) Foreach(f func(Apple))
- func (set SimpleAppleSet) Intersect(other SimpleAppleSet) SimpleAppleSet
- func (set SimpleAppleSet) IsEmpty() bool
- func (set SimpleAppleSet) IsSequence() bool
- func (set SimpleAppleSet) IsSet() bool
- func (set SimpleAppleSet) IsSubset(other SimpleAppleSet) bool
- func (set SimpleAppleSet) IsSuperset(other SimpleAppleSet) bool
- func (set SimpleAppleSet) Map(f func(Apple) Apple) SimpleAppleSet
- func (set SimpleAppleSet) MapToString(f func(Apple) string) []string
- func (set SimpleAppleSet) MaxBy(less func(Apple, Apple) bool) Apple
- func (set SimpleAppleSet) MinBy(less func(Apple, Apple) bool) Apple
- func (set SimpleAppleSet) NonEmpty() bool
- func (set SimpleAppleSet) Partition(p func(Apple) bool) (SimpleAppleSet, SimpleAppleSet)
- func (set SimpleAppleSet) Remove(i Apple)
- func (set SimpleAppleSet) Send() <-chan Apple
- func (set SimpleAppleSet) Size() int
- func (set SimpleAppleSet) SymmetricDifference(other SimpleAppleSet) SimpleAppleSet
- func (set SimpleAppleSet) ToInterfaceSlice() []interface{}
- func (set SimpleAppleSet) ToSet() SimpleAppleSet
- func (set SimpleAppleSet) ToSlice() []Apple
- func (set SimpleAppleSet) Union(other SimpleAppleSet) SimpleAppleSet
- type SimpleIntIntMap
- func (mm *SimpleIntIntMap) Clear()
- func (mm SimpleIntIntMap) Clone() SimpleIntIntMap
- func (mm SimpleIntIntMap) ContainsAllKeys(kk ...int) bool
- func (mm SimpleIntIntMap) ContainsKey(k int) bool
- func (mm SimpleIntIntMap) DropWhere(fn func(int, int) bool) SimpleIntIntTuples
- func (mm SimpleIntIntMap) Equals(other SimpleIntIntMap) bool
- func (mm SimpleIntIntMap) Exists(p func(int, int) bool) bool
- func (mm SimpleIntIntMap) Filter(p func(int, int) bool) SimpleIntIntMap
- func (mm SimpleIntIntMap) Find(p func(int, int) bool) (SimpleIntIntTuple, bool)
- func (mm SimpleIntIntMap) FlatMap(f func(int, int) []SimpleIntIntTuple) SimpleIntIntMap
- func (mm SimpleIntIntMap) Forall(p func(int, int) bool) bool
- func (mm SimpleIntIntMap) Foreach(f func(int, int))
- func (mm SimpleIntIntMap) Get(k int) (int, bool)
- func (mm SimpleIntIntMap) IsEmpty() bool
- func (mm SimpleIntIntMap) Keys() []int
- func (mm SimpleIntIntMap) Map(f func(int, int) (int, int)) SimpleIntIntMap
- func (mm SimpleIntIntMap) MkString(sep string) string
- func (mm SimpleIntIntMap) MkString4(before, between, after, equals string) string
- func (mm SimpleIntIntMap) NonEmpty() bool
- func (mm SimpleIntIntMap) OrderedSlice(keys []int) SimpleIntIntTuples
- func (mm SimpleIntIntMap) Partition(p func(int, int) bool) (matching SimpleIntIntMap, others SimpleIntIntMap)
- func (mm SimpleIntIntMap) Pop(k int) (int, bool)
- func (mm SimpleIntIntMap) Put(k int, v int) bool
- func (mm SimpleIntIntMap) Remove(k int)
- func (mm SimpleIntIntMap) Size() int
- func (mm SimpleIntIntMap) String() string
- func (mm SimpleIntIntMap) ToSlice() SimpleIntIntTuples
- func (mm SimpleIntIntMap) Values() []int
- type SimpleIntIntTuple
- type SimpleIntIntTuples
- func (ts SimpleIntIntTuples) Append1(k int, v int) SimpleIntIntTuples
- func (ts SimpleIntIntTuples) Append2(k1 int, v1 int, k2 int, v2 int) SimpleIntIntTuples
- func (ts SimpleIntIntTuples) Append3(k1 int, v1 int, k2 int, v2 int, k3 int, v3 int) SimpleIntIntTuples
- func (ts SimpleIntIntTuples) MkString(sep string) string
- func (ts SimpleIntIntTuples) MkString4(before, between, after, equals string) string
- func (ts SimpleIntIntTuples) String() string
- func (ts SimpleIntIntTuples) ToMap() SimpleIntIntMap
- func (ts SimpleIntIntTuples) Values(values ...int) SimpleIntIntTuples
- type SimpleIntList
- func (list SimpleIntList) Clone() SimpleIntList
- func (list SimpleIntList) Contains(v int) bool
- func (list SimpleIntList) ContainsAll(i ...int) bool
- func (list SimpleIntList) CountBy(p func(int) bool) (result int)
- func (list SimpleIntList) DistinctBy(equal func(int, int) bool) SimpleIntList
- func (list SimpleIntList) DoReverse() SimpleIntList
- func (list SimpleIntList) DoShuffle() SimpleIntList
- func (list SimpleIntList) Drop(n int) SimpleIntList
- func (list SimpleIntList) DropLast(n int) SimpleIntList
- func (list SimpleIntList) DropWhile(p func(int) bool) SimpleIntList
- func (list SimpleIntList) Equals(other SimpleIntList) bool
- func (list SimpleIntList) Exists(p func(int) bool) bool
- func (list SimpleIntList) Filter(p func(int) bool) SimpleIntList
- func (list SimpleIntList) Find(p func(int) bool) (int, bool)
- func (list SimpleIntList) FlatMap(f func(int) []int) SimpleIntList
- func (list SimpleIntList) FlatMapToInt64(f func(int) []int64) []int64
- func (list SimpleIntList) FlatMapToString(f func(int) []string) []string
- func (list SimpleIntList) Fold(initial int, fn func(int, int) int) int
- func (list SimpleIntList) Forall(p func(int) bool) bool
- func (list SimpleIntList) Foreach(f func(int))
- func (list SimpleIntList) Get(i int) int
- func (list SimpleIntList) Head() int
- func (list SimpleIntList) HeadOption() (int, bool)
- func (list SimpleIntList) IndexWhere(p func(int) bool) int
- func (list SimpleIntList) IndexWhere2(p func(int) bool, from int) int
- func (list SimpleIntList) Init() SimpleIntList
- func (list SimpleIntList) IsEmpty() bool
- func (list SimpleIntList) IsSequence() bool
- func (list SimpleIntList) IsSet() bool
- func (list SimpleIntList) Last() int
- func (list SimpleIntList) LastIndexWhere(p func(int) bool) int
- func (list SimpleIntList) LastIndexWhere2(p func(int) bool, before int) int
- func (list SimpleIntList) LastOption() (int, bool)
- func (list SimpleIntList) Len() int
- func (list SimpleIntList) Map(f func(int) int) SimpleIntList
- func (list SimpleIntList) MapToInt64(f func(int) int64) []int64
- func (list SimpleIntList) MapToString(f func(int) string) []string
- func (list SimpleIntList) Max() (result int)
- func (list SimpleIntList) MaxBy(less func(int, int) bool) int
- func (list SimpleIntList) Min() int
- func (list SimpleIntList) MinBy(less func(int, int) bool) int
- func (list SimpleIntList) MkString(sep string) string
- func (list SimpleIntList) MkString3(before, between, after string) string
- func (list SimpleIntList) NonEmpty() bool
- func (list SimpleIntList) Partition(p func(int) bool) (SimpleIntList, SimpleIntList)
- func (list SimpleIntList) Reverse() SimpleIntList
- func (list SimpleIntList) Send() <-chan int
- func (list SimpleIntList) Shuffle() SimpleIntList
- func (list SimpleIntList) Size() int
- func (list SimpleIntList) SortBy(less func(i, j int) bool) SimpleIntList
- func (list SimpleIntList) Sorted() SimpleIntList
- func (list SimpleIntList) StableSortBy(less func(i, j int) bool) SimpleIntList
- func (list SimpleIntList) StableSorted() SimpleIntList
- func (list SimpleIntList) String() string
- func (list SimpleIntList) StringList() []string
- func (list SimpleIntList) Sum() int
- func (list SimpleIntList) Swap(i, j int)
- func (list SimpleIntList) Tail() SimpleIntList
- func (list SimpleIntList) Take(n int) SimpleIntList
- func (list SimpleIntList) TakeLast(n int) SimpleIntList
- func (list SimpleIntList) TakeWhile(p func(int) bool) SimpleIntList
- func (list SimpleIntList) ToInterfaceSlice() []interface{}
- func (list SimpleIntList) ToList() SimpleIntList
- func (list SimpleIntList) ToSlice() []int
- type SimpleIntSet
- func (set SimpleIntSet) Add(more ...int) SimpleIntSet
- func (set SimpleIntSet) Append(more ...int) SimpleIntSet
- func (set SimpleIntSet) Cardinality() int
- func (set *SimpleIntSet) Clear()
- func (set SimpleIntSet) Clone() SimpleIntSet
- func (set SimpleIntSet) Contains(i int) bool
- func (set SimpleIntSet) ContainsAll(i ...int) bool
- func (set SimpleIntSet) CountBy(p func(int) bool) (result int)
- func (set SimpleIntSet) Difference(other SimpleIntSet) SimpleIntSet
- func (set SimpleIntSet) Equals(other SimpleIntSet) bool
- func (set SimpleIntSet) Exists(p func(int) bool) bool
- func (set SimpleIntSet) Filter(p func(int) bool) SimpleIntSet
- func (set SimpleIntSet) Find(p func(int) bool) (int, bool)
- func (set SimpleIntSet) FlatMap(f func(int) []int) SimpleIntSet
- func (set SimpleIntSet) FlatMapToInt64(f func(int) []int64) []int64
- func (set SimpleIntSet) FlatMapToString(f func(int) []string) []string
- func (set SimpleIntSet) Fold(initial int, fn func(int, int) int) int
- func (set SimpleIntSet) Forall(p func(int) bool) bool
- func (set SimpleIntSet) Foreach(f func(int))
- func (set SimpleIntSet) Intersect(other SimpleIntSet) SimpleIntSet
- func (set SimpleIntSet) IsEmpty() bool
- func (set SimpleIntSet) IsSequence() bool
- func (set SimpleIntSet) IsSet() bool
- func (set SimpleIntSet) IsSubset(other SimpleIntSet) bool
- func (set SimpleIntSet) IsSuperset(other SimpleIntSet) bool
- func (set SimpleIntSet) Map(f func(int) int) SimpleIntSet
- func (set SimpleIntSet) MapToInt64(f func(int) int64) []int64
- func (set SimpleIntSet) MapToString(f func(int) string) []string
- func (set SimpleIntSet) MarshalJSON() ([]byte, error)
- func (set SimpleIntSet) Max() int
- func (set SimpleIntSet) MaxBy(less func(int, int) bool) int
- func (set SimpleIntSet) Min() int
- func (set SimpleIntSet) MinBy(less func(int, int) bool) int
- func (set SimpleIntSet) MkString(sep string) string
- func (set SimpleIntSet) MkString3(before, between, after string) string
- func (set SimpleIntSet) NonEmpty() bool
- func (set SimpleIntSet) Partition(p func(int) bool) (SimpleIntSet, SimpleIntSet)
- func (set SimpleIntSet) Remove(i int)
- func (set SimpleIntSet) Send() <-chan int
- func (set SimpleIntSet) Size() int
- func (set SimpleIntSet) String() string
- func (set SimpleIntSet) StringList() []string
- func (set SimpleIntSet) StringMap() map[string]bool
- func (set SimpleIntSet) Sum() int
- func (set SimpleIntSet) SymmetricDifference(other SimpleIntSet) SimpleIntSet
- func (set SimpleIntSet) ToInterfaceSlice() []interface{}
- func (set SimpleIntSet) ToSet() SimpleIntSet
- func (set SimpleIntSet) ToSlice() []int
- func (set SimpleIntSet) Union(other SimpleIntSet) SimpleIntSet
- func (set SimpleIntSet) UnmarshalJSON(b []byte) error
- type SimpleStringAppleMap
- func (mm *SimpleStringAppleMap) Clear()
- func (mm SimpleStringAppleMap) Clone() SimpleStringAppleMap
- func (mm SimpleStringAppleMap) ContainsAllKeys(kk ...string) bool
- func (mm SimpleStringAppleMap) ContainsKey(k string) bool
- func (mm SimpleStringAppleMap) DropWhere(fn func(string, Apple) bool) SimpleStringAppleTuples
- func (mm SimpleStringAppleMap) Exists(p func(string, Apple) bool) bool
- func (mm SimpleStringAppleMap) Filter(p func(string, Apple) bool) SimpleStringAppleMap
- func (mm SimpleStringAppleMap) Find(p func(string, Apple) bool) (SimpleStringAppleTuple, bool)
- func (mm SimpleStringAppleMap) FlatMap(f func(string, Apple) []SimpleStringAppleTuple) SimpleStringAppleMap
- func (mm SimpleStringAppleMap) Forall(p func(string, Apple) bool) bool
- func (mm SimpleStringAppleMap) Foreach(f func(string, Apple))
- func (mm SimpleStringAppleMap) Get(k string) (Apple, bool)
- func (mm SimpleStringAppleMap) IsEmpty() bool
- func (mm SimpleStringAppleMap) Keys() []string
- func (mm SimpleStringAppleMap) Map(f func(string, Apple) (string, Apple)) SimpleStringAppleMap
- func (mm SimpleStringAppleMap) MkString(sep string) string
- func (mm SimpleStringAppleMap) MkString4(before, between, after, equals string) string
- func (mm SimpleStringAppleMap) NonEmpty() bool
- func (mm SimpleStringAppleMap) OrderedSlice(keys []string) SimpleStringAppleTuples
- func (mm SimpleStringAppleMap) Partition(p func(string, Apple) bool) (matching SimpleStringAppleMap, others SimpleStringAppleMap)
- func (mm SimpleStringAppleMap) Pop(k string) (Apple, bool)
- func (mm SimpleStringAppleMap) Put(k string, v Apple) bool
- func (mm SimpleStringAppleMap) Remove(k string)
- func (mm SimpleStringAppleMap) Size() int
- func (mm SimpleStringAppleMap) String() string
- func (mm SimpleStringAppleMap) ToSlice() SimpleStringAppleTuples
- func (mm SimpleStringAppleMap) Values() []Apple
- type SimpleStringAppleTuple
- type SimpleStringAppleTuples
- func (ts SimpleStringAppleTuples) Append1(k string, v Apple) SimpleStringAppleTuples
- func (ts SimpleStringAppleTuples) Append2(k1 string, v1 Apple, k2 string, v2 Apple) SimpleStringAppleTuples
- func (ts SimpleStringAppleTuples) Append3(k1 string, v1 Apple, k2 string, v2 Apple, k3 string, v3 Apple) SimpleStringAppleTuples
- func (ts SimpleStringAppleTuples) MkString(sep string) string
- func (ts SimpleStringAppleTuples) MkString4(before, between, after, equals string) string
- func (ts SimpleStringAppleTuples) String() string
- func (ts SimpleStringAppleTuples) ToMap() SimpleStringAppleMap
- func (ts SimpleStringAppleTuples) Values(values ...Apple) SimpleStringAppleTuples
- type SimpleStringList
- func (list SimpleStringList) Clone() SimpleStringList
- func (list SimpleStringList) Contains(v string) bool
- func (list SimpleStringList) ContainsAll(i ...string) bool
- func (list SimpleStringList) CountBy(p func(string) bool) (result int)
- func (list SimpleStringList) DistinctBy(equal func(string, string) bool) SimpleStringList
- func (list SimpleStringList) DoReverse() SimpleStringList
- func (list SimpleStringList) DoShuffle() SimpleStringList
- func (list SimpleStringList) Drop(n int) SimpleStringList
- func (list SimpleStringList) DropLast(n int) SimpleStringList
- func (list SimpleStringList) DropWhile(p func(string) bool) SimpleStringList
- func (list SimpleStringList) Equals(other SimpleStringList) bool
- func (list SimpleStringList) Exists(p func(string) bool) bool
- func (list SimpleStringList) Filter(p func(string) bool) SimpleStringList
- func (list SimpleStringList) Find(p func(string) bool) (string, bool)
- func (list SimpleStringList) FlatMap(f func(string) []string) SimpleStringList
- func (list SimpleStringList) FlatMapToInt(f func(string) []int) []int
- func (list SimpleStringList) Fold(initial string, fn func(string, string) string) string
- func (list SimpleStringList) Forall(p func(string) bool) bool
- func (list SimpleStringList) Foreach(f func(string))
- func (list SimpleStringList) Get(i int) string
- func (list SimpleStringList) Head() string
- func (list SimpleStringList) HeadOption() (string, bool)
- func (list SimpleStringList) IndexWhere(p func(string) bool) int
- func (list SimpleStringList) IndexWhere2(p func(string) bool, from int) int
- func (list SimpleStringList) Init() SimpleStringList
- func (list SimpleStringList) IsEmpty() bool
- func (list SimpleStringList) IsSequence() bool
- func (list SimpleStringList) IsSet() bool
- func (list SimpleStringList) Last() string
- func (list SimpleStringList) LastIndexWhere(p func(string) bool) int
- func (list SimpleStringList) LastIndexWhere2(p func(string) bool, before int) int
- func (list SimpleStringList) LastOption() (string, bool)
- func (list SimpleStringList) Len() int
- func (list SimpleStringList) Map(f func(string) string) SimpleStringList
- func (list SimpleStringList) MapToInt(f func(string) int) []int
- func (list SimpleStringList) Max() (result string)
- func (list SimpleStringList) MaxBy(less func(string, string) bool) string
- func (list SimpleStringList) Min() string
- func (list SimpleStringList) MinBy(less func(string, string) bool) string
- func (list SimpleStringList) MkString(sep string) string
- func (list SimpleStringList) MkString3(before, between, after string) string
- func (list SimpleStringList) NonEmpty() bool
- func (list SimpleStringList) Partition(p func(string) bool) (SimpleStringList, SimpleStringList)
- func (list SimpleStringList) Reverse() SimpleStringList
- func (list SimpleStringList) Send() <-chan string
- func (list SimpleStringList) Shuffle() SimpleStringList
- func (list SimpleStringList) Size() int
- func (list SimpleStringList) SortBy(less func(i, j string) bool) SimpleStringList
- func (list SimpleStringList) Sorted() SimpleStringList
- func (list SimpleStringList) StableSortBy(less func(i, j string) bool) SimpleStringList
- func (list SimpleStringList) StableSorted() SimpleStringList
- func (list SimpleStringList) String() string
- func (list SimpleStringList) StringList() []string
- func (list SimpleStringList) Swap(i, j int)
- func (list SimpleStringList) Tail() SimpleStringList
- func (list SimpleStringList) Take(n int) SimpleStringList
- func (list SimpleStringList) TakeLast(n int) SimpleStringList
- func (list SimpleStringList) TakeWhile(p func(string) bool) SimpleStringList
- func (list SimpleStringList) ToInterfaceSlice() []interface{}
- func (list SimpleStringList) ToList() SimpleStringList
- func (list SimpleStringList) ToSlice() []string
- type StringAppleMap
- func (mm *StringAppleMap) Clear()
- func (mm *StringAppleMap) Clone() *StringAppleMap
- func (mm *StringAppleMap) ContainsAllKeys(kk ...string) bool
- func (mm *StringAppleMap) ContainsKey(k string) bool
- func (mm *StringAppleMap) DropWhere(fn func(string, Apple) bool) StringAppleTuples
- func (mm *StringAppleMap) Equals(other *StringAppleMap) bool
- func (mm *StringAppleMap) Exists(p func(string, Apple) bool) bool
- func (mm *StringAppleMap) Filter(p func(string, Apple) bool) *StringAppleMap
- func (mm *StringAppleMap) Find(p func(string, Apple) bool) (StringAppleTuple, bool)
- func (mm *StringAppleMap) FlatMap(f func(string, Apple) []StringAppleTuple) *StringAppleMap
- func (mm *StringAppleMap) Forall(p func(string, Apple) bool) bool
- func (mm *StringAppleMap) Foreach(f func(string, Apple))
- func (mm *StringAppleMap) Get(k string) (Apple, bool)
- func (mm *StringAppleMap) GobDecode(b []byte) error
- func (mm *StringAppleMap) GobEncode() ([]byte, error)
- func (mm *StringAppleMap) IsEmpty() bool
- func (mm *StringAppleMap) Keys() []string
- func (mm *StringAppleMap) Map(f func(string, Apple) (string, Apple)) *StringAppleMap
- func (mm *StringAppleMap) MarshalJSON() ([]byte, error)
- func (mm *StringAppleMap) MkString(sep string) string
- func (mm *StringAppleMap) MkString4(before, between, after, equals string) string
- func (mm *StringAppleMap) NonEmpty() bool
- func (mm *StringAppleMap) OrderedSlice(keys []string) StringAppleTuples
- func (mm *StringAppleMap) Partition(p func(string, Apple) bool) (matching *StringAppleMap, others *StringAppleMap)
- func (mm *StringAppleMap) Pop(k string) (Apple, bool)
- func (mm *StringAppleMap) Put(k string, v Apple) bool
- func (mm *StringAppleMap) Remove(k string)
- func (mm *StringAppleMap) Size() int
- func (mm *StringAppleMap) String() string
- func (mm *StringAppleMap) ToSlice() StringAppleTuples
- func (mm *StringAppleMap) UnmarshalJSON(b []byte) error
- func (mm *StringAppleMap) Values() []Apple
- type StringAppleTuple
- type StringAppleTuples
- func (ts StringAppleTuples) Append1(k string, v Apple) StringAppleTuples
- func (ts StringAppleTuples) Append2(k1 string, v1 Apple, k2 string, v2 Apple) StringAppleTuples
- func (ts StringAppleTuples) Append3(k1 string, v1 Apple, k2 string, v2 Apple, k3 string, v3 Apple) StringAppleTuples
- func (ts StringAppleTuples) MkString(sep string) string
- func (ts StringAppleTuples) MkString4(before, between, after, equals string) string
- func (ts StringAppleTuples) String() string
- func (ts StringAppleTuples) ToMap() *StringAppleMap
- func (ts StringAppleTuples) Values(values ...Apple) StringAppleTuples
- type StringList
- func (list *StringList) Add(more ...string)
- func (list *StringList) Append(more ...string) *StringList
- func (list *StringList) Clear()
- 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) DoDeleteAt(index, n int) *StringList
- func (list *StringList) DoDeleteFirst(n int) *StringList
- func (list *StringList) DoDeleteLast(n int) *StringList
- func (list *StringList) DoInsertAt(index int, more ...string) *StringList
- func (list *StringList) DoKeepWhere(p func(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) 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) MarshalJSON() ([]byte, error)
- func (list *StringList) Max() (result string)
- func (list *StringList) MaxBy(less func(string, string) bool) string
- func (list *StringList) Min() string
- func (list *StringList) MinBy(less func(string, string) bool) string
- func (list *StringList) 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) StableSorted() *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) ToSlice() []string
- func (list *StringList) UnmarshalJSON(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppleBlackHole ¶
func AppleBlackHole(in <-chan Apple)
AppleBlackHole silently consumes a stream of Apple. It terminates when the sender closes the channel.
It is part of the Plumbing function suite for Apple.
func AppleDelta ¶
AppleDelta duplicates a stream of Apple to two output channels. When the sender closes the input channel, both output channels are closed then the function terminates.
It is part of the Plumbing function suite for Apple.
func AppleFilter ¶
AppleFilter filters a stream of Apple, silently dropping elements that do not match the predicate p. When the sender closes the input channel, the output channel is closed then the function terminates.
It is part of the Plumbing function suite for Apple.
func AppleFlatMap ¶
func AppleFlatMap(in <-chan Apple, out chan<- Apple, fn func(Apple) AppleCollection)
AppleFlatMap transforms a stream of Apple by applying a function fn to each item in the stream that gives zero or more results, all of which are sent out. When the sender closes the input channel, the output channel is closed then the function terminates.
It is part of the Plumbing function suite for Apple.
func AppleFlatMapToInt ¶
func AppleFlatMapToInt(in <-chan Apple, out chan<- int, fn func(Apple) IntCollection)
AppleFlatMapToInt transforms a stream of Apple to a stream of int. When the sender closes the input channel, the output channel is closed then the function terminates.
func AppleGenerator ¶
AppleGenerator produces a stream of Apple based on a supplied generator function. The function fn is invoked N times with the integers from 0 to N-1. Each result is sent out. Finally, the output channel is closed and the generator terminates.
It is part of the Plumbing function suite for Apple.
func AppleGenerator3 ¶
AppleGenerator produces a stream of Apple based on a supplied generator function. The function fn is invoked *(|to - from|) / |stride|* times with the integers in the range specified by from, to and stride. If stride is negative, from should be greater than to. For each iteration, the computed function result is sent out. If stride is zero, the loop never terminates. Otherwise, after the generator has reached the loop end, the output channel is closed and the generator terminates.
It is part of the Plumbing function suite for Apple.
func AppleMap ¶
AppleMap transforms a stream of Apple by applying a function fn to each item in the stream. When the sender closes the input channel, the output channel is closed then the function terminates.
It is part of the Plumbing function suite for Apple.
func AppleMapToInt ¶
AppleMapToInt transforms a stream of Apple to a stream of int. When the sender closes the input channel, the output channel is closed then the function terminates.
func AppleMux2 ¶
AppleMux2 multiplexes two streams of Apple into a single output channel. Each input channel is used as soon as it is ready. When a signal is received from the closer channel, the output channel is then closed. Concurrently, both input channels are then passed into blackholes that comsume them until they too are closed, and the function terminates.
It is part of the Plumbing function suite for Apple.
func ApplePartition ¶
ApplePartition filters a stream of Apple into two output streams using a predicate p, those that match and all others. When the sender closes the input channel, both output channels are closed then the function terminates.
It is part of the Plumbing function suite for Apple.
func AppleZip2 ¶
AppleZip2 interleaves two streams of Apple. Each input channel is used in turn, alternating between them. The function terminates when *both* input channels have been closed by their senders. The output channel is then closed also.
It is part of the Plumbing function suite for Apple.
Types ¶
type Apple ¶
type Apple struct{}
Apple is an empty placeholder used for the examples. "Insert your own type!"
type AppleCollection ¶
type AppleCollection interface { AppleSizer // 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() []Apple // ToInterfaceSlice returns a shallow copy as a slice of arbitrary type. ToInterfaceSlice() []interface{} // Exists verifies that one or more elements of AppleCollection return true for the predicate p. Exists(p func(Apple) bool) bool // Forall verifies that all elements of AppleCollection return true for the predicate p. Forall(p func(Apple) bool) bool // Foreach iterates over AppleCollection and executes the function f against each element. Foreach(f func(Apple)) // Find returns the first Apple that returns true for the predicate p. // False is returned if none match. Find(p func(Apple) bool) (Apple, bool) // MapToString returns a new []string by transforming every element with function f. // The resulting slice is the same size as the collection. The collection is not modified. MapToString(f func(Apple) string) []string // FlatMapString returns a new []string by transforming every element with function f // that returns zero or more items in a slice. The resulting slice may have a different size to the // collection. The collection is not modified. FlatMapToString(f func(Apple) []string) []string // Send returns a channel that will send all the elements in order. Can be used with the plumbing code, for example. // A goroutine is created to send the elements; this only terminates when all the elements have been consumed Send() <-chan Apple // CountBy gives the number elements of AppleCollection that return true for the predicate p. CountBy(p func(Apple) bool) int // Clear the entire collection. Clear() // Add adds items to the current collection. Add(more ...Apple) // MinBy returns an element of AppleCollection 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(Apple, Apple) bool) Apple // MaxBy returns an element of AppleCollection 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(Apple, Apple) bool) Apple // Fold aggregates all the values in the collection using a supplied function, starting from some initial value. Fold(initial Apple, fn func(Apple, Apple) Apple) Apple }
AppleCollection defines an interface for common collection methods on Apple.
type AppleList ¶
type AppleList struct {
// contains filtered or unexported fields
}
AppleList contains a slice of type Apple. It encapsulates the slice and provides methods to access or mutate it.
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 BuildAppleListFromChan ¶
BuildAppleListFromChan constructs a new AppleList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertAppleList ¶
ConvertAppleList 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 MakeAppleList ¶
MakeAppleList makes an empty list with both length and capacity initialised.
func NewAppleList ¶
NewAppleList constructs a new list containing the supplied values, if any.
func (*AppleList) Append ¶
Append adds items to the current list. If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned.
func (*AppleList) Clone ¶
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (*AppleList) Contains ¶
Contains determines whether a given item is already in the list, returning true if so.
func (*AppleList) 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 (*AppleList) CountBy ¶
CountBy gives the number elements of AppleList that return true for the predicate p.
func (*AppleList) DistinctBy ¶
DistinctBy returns a new AppleList whose elements are unique, where equality is defined by the equal function.
func (*AppleList) DoDeleteAt ¶
DoDeleteAt modifies a AppleList by deleting n elements from a given index.
The list is modified and the modified list is returned. Panics if the index is out of range or n is large enough to take the index out of range.
func (*AppleList) DoDeleteFirst ¶
DoDeleteFirst modifies a AppleList by deleting n elements from the start of the list.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if n is large enough to take the index out of range.
func (*AppleList) DoDeleteLast ¶
DoDeleteLast modifies a AppleList by deleting n elements from the end of the list.
The list is modified and the modified list is returned. Panics if n is large enough to take the index out of range.
func (*AppleList) DoInsertAt ¶
DoInsertAt modifies a AppleList by inserting elements at a given index. This is a generalised version of Append.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if the index is out of range.
func (*AppleList) DoKeepWhere ¶
DoKeepWhere modifies a AppleList by retaining only those elements that match the predicate p. This is very similar to Filter but alters the list in place.
The list is modified and the modified list is returned.
func (*AppleList) DoReverse ¶
DoReverse alters a AppleList 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 (*AppleList) DoShuffle ¶
DoShuffle returns a shuffled AppleList, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (*AppleList) Drop ¶
Drop returns a slice of AppleList 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 (*AppleList) DropLast ¶
DropLast returns a slice of AppleList 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 (*AppleList) DropWhile ¶
DropWhile returns a new AppleList 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 (*AppleList) 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. Nil lists are considered to be empty.
func (*AppleList) Exists ¶
Exists verifies that one or more elements of AppleList return true for the predicate p.
func (*AppleList) Filter ¶
Filter returns a new AppleList whose elements return true for predicate p.
The original list is not modified. See also DoKeepWhere (which does modify the original list).
func (*AppleList) Find ¶
Find returns the first Apple that returns true for predicate p. False is returned if none match.
func (*AppleList) FlatMap ¶
FlatMap returns a new AppleList 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 (*AppleList) 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 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 (*AppleList) Fold ¶ added in v3.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (*AppleList) Forall ¶
Forall verifies that all elements of AppleList return true for the predicate p.
func (*AppleList) Foreach ¶
Foreach iterates over AppleList and executes function f against each element. The function can safely alter the values via side-effects.
func (*AppleList) Get ¶
Get gets the specified element in the list. Panics if the index is out of range or the list is nil.
func (*AppleList) GobDecode ¶
GobDecode implements 'gob' decoding for this list type. You must register Apple with the 'gob' package before this method is used.
func (AppleList) GobEncode ¶
GobEncode implements 'gob' encoding for this list type. You must register Apple with the 'gob' package before this method is used.
func (*AppleList) 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 (*AppleList) HeadOption ¶
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (*AppleList) IndexWhere ¶
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (*AppleList) 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 (*AppleList) 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 (*AppleList) IsSequence ¶
IsSequence returns true for lists and queues.
func (*AppleList) 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 (*AppleList) LastIndexWhere ¶
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (*AppleList) 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 (*AppleList) LastOption ¶
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (*AppleList) 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 (*AppleList) Map ¶
Map returns a new AppleList 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 (*AppleList) MapToString ¶
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 (*AppleList) MaxBy ¶
MaxBy returns an element of AppleList 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 (*AppleList) MinBy ¶
MinBy returns an element of AppleList 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 (*AppleList) Partition ¶
Partition returns two new AppleLists 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 (*AppleList) Reverse ¶
Reverse returns a copy of AppleList with all elements in the reverse order.
The original list is not modified.
func (*AppleList) 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 (*AppleList) Shuffle ¶
Shuffle returns a shuffled copy of AppleList, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (*AppleList) 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 (*AppleList) 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 (*AppleList) Swap ¶
Swap exchanges two elements, which is necessary during sorting etc. This is one of the three methods in the standard sort.Interface.
func (*AppleList) 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 (*AppleList) Take ¶
Take returns a slice of AppleList 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 (*AppleList) TakeLast ¶
TakeLast returns a slice of AppleList 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 (*AppleList) TakeWhile ¶
TakeWhile returns a new AppleList 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 (*AppleList) ToInterfaceSlice ¶
func (list *AppleList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
type AppleQueue ¶
type AppleQueue struct {
// contains filtered or unexported fields
}
AppleQueue is a ring buffer containing a slice of type Apple. It is optimised for FIFO operations.
func BuildAppleQueueFromChan ¶
func BuildAppleQueueFromChan(source <-chan Apple) *AppleQueue
BuildAppleQueueFromChan constructs a new AppleQueue from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func NewAppleQueue ¶
func NewAppleQueue(capacity int, overwrite bool) *AppleQueue
NewAppleQueue returns a new queue of Apple. 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 NewAppleSortedQueue ¶
func NewAppleSortedQueue(capacity int, overwrite bool, less func(i, j Apple) bool) *AppleQueue
NewAppleSortedQueue returns a new queue of Apple. 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 (*AppleQueue) Add ¶
func (queue *AppleQueue) Add(more ...Apple)
Add adds items to the queue. This is a synonym for Push.
func (*AppleQueue) Clone ¶
func (queue *AppleQueue) Clone() *AppleQueue
Clone returns a shallow copy of the queue. It does not clone the underlying elements.
func (*AppleQueue) CountBy ¶
func (queue *AppleQueue) CountBy(p func(Apple) bool) (result int)
CountBy gives the number elements of AppleQueue that return true for the predicate p.
func (*AppleQueue) DoKeepWhere ¶
func (queue *AppleQueue) DoKeepWhere(p func(Apple) bool) *AppleQueue
DoKeepWhere modifies a AppleQueue 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 (*AppleQueue) Exists ¶
func (queue *AppleQueue) Exists(p func(Apple) bool) bool
Exists verifies that one or more elements of AppleQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*AppleQueue) Filter ¶
func (queue *AppleQueue) Filter(p func(Apple) bool) *AppleQueue
Filter returns a new AppleQueue whose elements return true for predicate p.
The original queue is not modified. See also DoKeepWhere (which does modify the original queue).
func (*AppleQueue) Find ¶
func (queue *AppleQueue) Find(p func(Apple) bool) (Apple, bool)
Find returns the first Apple that returns true for predicate p. False is returned if none match.
func (*AppleQueue) FlatMap ¶
func (queue *AppleQueue) FlatMap(f func(Apple) []Apple) *AppleQueue
FlatMap returns a new AppleQueue 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 (*AppleQueue) FlatMapToString ¶
func (queue *AppleQueue) FlatMapToString(f func(Apple) []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 (*AppleQueue) Fold ¶ added in v3.9.0
Fold aggregates all the values in the queue using a supplied function, starting from some initial value.
func (*AppleQueue) Forall ¶
func (queue *AppleQueue) Forall(p func(Apple) bool) bool
Forall verifies that all elements of AppleQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*AppleQueue) Foreach ¶
func (queue *AppleQueue) Foreach(f func(Apple))
Foreach iterates over AppleQueue and executes function f against each element. The function can safely alter the values via side-effects.
func (*AppleQueue) Get ¶
func (queue *AppleQueue) Get(i int) Apple
Get gets the specified element in the queue. Panics if the index is out of range or the queue is nil.
func (*AppleQueue) Head ¶
func (queue *AppleQueue) Head() Apple
Head gets the first element in the queue. Head is the opposite of Last. Panics if queue is empty or nil.
func (*AppleQueue) HeadOption ¶
func (queue *AppleQueue) HeadOption() (Apple, 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 (*AppleQueue) IsEmpty ¶
func (queue *AppleQueue) IsEmpty() bool
IsEmpty returns true if the queue is empty.
func (*AppleQueue) IsFull ¶
func (queue *AppleQueue) IsFull() bool
IsFull returns true if the queue is full.
func (*AppleQueue) IsOverwriting ¶
func (queue *AppleQueue) IsOverwriting() bool
IsOverwriting returns true if the queue is overwriting, false if refusing.
func (*AppleQueue) IsSequence ¶
func (queue *AppleQueue) IsSequence() bool
IsSequence returns true for ordered lists and queues.
func (*AppleQueue) IsSet ¶
func (queue *AppleQueue) IsSet() bool
IsSet returns false for lists or queues.
func (*AppleQueue) Last ¶
func (queue *AppleQueue) Last() Apple
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 (*AppleQueue) LastOption ¶
func (queue *AppleQueue) LastOption() (Apple, 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 (*AppleQueue) Len ¶
func (queue *AppleQueue) Len() int
Len gets the current length of this queue. This is an alias for Size.
func (*AppleQueue) Less ¶
func (queue *AppleQueue) 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 (*AppleQueue) Map ¶
func (queue *AppleQueue) Map(f func(Apple) Apple) *AppleQueue
Map returns a new AppleQueue 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 (*AppleQueue) MapToString ¶
func (queue *AppleQueue) MapToString(f func(Apple) 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 (*AppleQueue) MaxBy ¶
func (queue *AppleQueue) MaxBy(less func(Apple, Apple) bool) Apple
MaxBy returns an element of AppleQueue 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 (*AppleQueue) MinBy ¶
func (queue *AppleQueue) MinBy(less func(Apple, Apple) bool) Apple
MinBy returns an element of AppleQueue 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 (*AppleQueue) NonEmpty ¶
func (queue *AppleQueue) NonEmpty() bool
NonEmpty returns true if the queue is not empty.
func (*AppleQueue) Offer ¶
func (queue *AppleQueue) Offer(items ...Apple) []Apple
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 (*AppleQueue) Partition ¶
func (queue *AppleQueue) Partition(p func(Apple) bool) (*AppleQueue, *AppleQueue)
Partition returns two new AppleQueues 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 (*AppleQueue) Pop ¶
func (queue *AppleQueue) Pop(n int) []Apple
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 (*AppleQueue) Pop1 ¶
func (queue *AppleQueue) Pop1() (Apple, 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 (*AppleQueue) Push ¶
func (queue *AppleQueue) Push(items ...Apple) *AppleQueue
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 (*AppleQueue) Reallocate ¶
func (queue *AppleQueue) Reallocate(capacity int, overwrite bool) *AppleQueue
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 (*AppleQueue) Send ¶
func (queue *AppleQueue) Send() <-chan Apple
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 (*AppleQueue) Size ¶
func (queue *AppleQueue) Size() int
Size gets the number of elements currently in this queue. This is an alias for Len.
func (*AppleQueue) Sort ¶
func (queue *AppleQueue) 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 NewAppleSortedQueue).
func (*AppleQueue) Space ¶
func (queue *AppleQueue) Space() int
Space returns the space available in the queue.
func (*AppleQueue) StableSort ¶
func (queue *AppleQueue) 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 NewAppleSortedQueue).
func (*AppleQueue) Swap ¶
func (queue *AppleQueue) Swap(i, j int)
Swap swaps the elements with indexes i and j. The queue must not be empty.
func (*AppleQueue) ToInterfaceSlice ¶
func (queue *AppleQueue) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the queue as a slice of arbitrary type. The queue is not altered.
func (*AppleQueue) ToSlice ¶
func (queue *AppleQueue) ToSlice() []Apple
ToSlice returns the elements of the queue as a slice. The queue is not altered.
type AppleSequence ¶ added in v3.9.0
type AppleSequence interface { AppleCollection // Head gets the first element in the sequence. Head plus Tail include the whole sequence. Head is the opposite of Last. Head() Apple // HeadOption gets the first element in the sequence, if possible. HeadOption() (Apple, bool) // Last gets the last element in the sequence. Init plus Last include the whole sequence. Last is the opposite of Head. Last() Apple // LastOption gets the last element in the sequence, if possible. LastOption() (Apple, bool) }
AppleSequence defines an interface for sequence methods on Apple.
type AppleSet ¶
type AppleSet struct {
// contains filtered or unexported fields
}
AppleSet is the primary type that represents a set.
func BuildAppleSetFromChan ¶
BuildAppleSetFromChan constructs a new AppleSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertAppleSet ¶
ConvertAppleSet 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 NewAppleSet ¶
NewAppleSet creates and returns a reference to an empty set.
func (*AppleSet) Cardinality ¶
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*AppleSet) Clear ¶
func (set *AppleSet) Clear()
Clear the entire set. Aterwards, it will be an empty set.
func (*AppleSet) Clone ¶
Clone returns a shallow copy of the set. It does not clone the underlying elements.
func (*AppleSet) Contains ¶
Contains determines whether a given item is already in the set, returning true if so.
func (*AppleSet) ContainsAll ¶
ContainsAll determines whether the given items are all in the set, returning true if so.
func (*AppleSet) CountBy ¶
CountBy gives the number elements of AppleSet that return true for the predicate p.
func (*AppleSet) Difference ¶
Difference returns a new set with items in the current set but not in the other set
func (*AppleSet) 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 (*AppleSet) 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 (*AppleSet) Filter ¶
Filter returns a new AppleSet whose elements return true for the predicate p.
The original set is not modified
func (*AppleSet) Find ¶
Find returns the first Apple that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.
func (*AppleSet) FlatMap ¶
FlatMap returns a new AppleSet 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 (*AppleSet) Fold ¶ added in v3.9.0
Fold aggregates all the values in the set using a supplied function, starting from some initial value.
func (*AppleSet) 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 (*AppleSet) Foreach ¶
Foreach iterates over the set and executes the function f against each element. The function can safely alter the values via side-effects.
func (*AppleSet) GobDecode ¶
GobDecode implements 'gob' decoding for this set type. You must register Apple with the 'gob' package before this method is used.
func (AppleSet) GobEncode ¶
GobEncode implements 'gob' encoding for this list type. You must register Apple with the 'gob' package before this method is used.
func (*AppleSet) IsSequence ¶
IsSequence returns true for lists and queues.
func (*AppleSet) IsSubset ¶
IsSubset determines whether every item in the other set is in this set, returning true if so.
func (*AppleSet) IsSuperset ¶
IsSuperset determines whether every item of this set is in the other set, returning true if so.
func (*AppleSet) Map ¶
Map returns a new AppleSet 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 (*AppleSet) MaxBy ¶
MaxBy returns an element of AppleSet 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 (*AppleSet) MinBy ¶
MinBy returns an element of AppleSet 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 (*AppleSet) Partition ¶
Partition returns two new AppleSets whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list.
The original set is not modified
func (*AppleSet) 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 (*AppleSet) Size ¶
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (*AppleSet) SymmetricDifference ¶
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (*AppleSet) ToInterfaceSlice ¶
func (set *AppleSet) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.
type AppleSizer ¶
type AppleSizer interface { // IsEmpty tests whether AppleCollection is empty. IsEmpty() bool // NonEmpty tests whether AppleCollection is empty. NonEmpty() bool // Size returns the number of items in the collection - an alias of Len(). Size() int }
AppleSizer defines an interface for sizing methods on Apple collections.
type Email ¶
type Email string
Email is a specialised kind of string.
func (Email) MarshalText ¶
MarshalText converts values to a form suitable for transmission via JSON, XML etc. https://golang.org/pkg/encoding/#TextMarshaler
func (*Email) Scan ¶
Scan parses some value. It implements sql.Scanner, https://golang.org/pkg/database/sql/#Scanner
func (*Email) UnmarshalText ¶
UnmarshalText converts transmitted values to ordinary values. https://golang.org/pkg/encoding/#TextUnmarshaler
type EmailSlice ¶
type EmailSlice []Email
EmailSlice attaches the methods of sort.Interface to []Email, sorting in increasing order.
func (EmailSlice) Len ¶
func (p EmailSlice) Len() int
func (EmailSlice) Less ¶
func (p EmailSlice) Less(i, j int) bool
func (EmailSlice) Swap ¶
func (p EmailSlice) Swap(i, j int)
type FastAppleCollection ¶
type FastAppleCollection interface { FastAppleSizer // 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() []Apple // ToInterfaceSlice returns a shallow copy as a slice of arbitrary type. ToInterfaceSlice() []interface{} // Exists verifies that one or more elements of FastAppleCollection return true for the predicate p. Exists(p func(Apple) bool) bool // Forall verifies that all elements of FastAppleCollection return true for the predicate p. Forall(p func(Apple) bool) bool // Foreach iterates over FastAppleCollection and executes the function f against each element. Foreach(f func(Apple)) // Find returns the first Apple that returns true for the predicate p. // False is returned if none match. Find(p func(Apple) bool) (Apple, 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 Apple // CountBy gives the number elements of FastAppleCollection that return true for the predicate p. CountBy(p func(Apple) bool) int // Clear the entire collection. Clear() // Add adds items to the current collection. Add(more ...Apple) // MinBy returns an element of FastAppleCollection 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(Apple, Apple) bool) Apple // MaxBy returns an element of FastAppleCollection 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(Apple, Apple) bool) Apple // Fold aggregates all the values in the collection using a supplied function, starting from some initial value. Fold(initial Apple, fn func(Apple, Apple) Apple) Apple }
FastAppleCollection defines an interface for common collection methods on Apple.
type FastAppleList ¶
type FastAppleList struct {
// contains filtered or unexported fields
}
FastAppleList contains a slice of type Apple. It encapsulates the slice and provides methods to access or mutate it.
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 BuildFastAppleListFromChan ¶
func BuildFastAppleListFromChan(source <-chan Apple) *FastAppleList
BuildFastAppleListFromChan constructs a new FastAppleList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertFastAppleList ¶
func ConvertFastAppleList(values ...interface{}) (*FastAppleList, bool)
ConvertFastAppleList 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 MakeFastAppleList ¶
func MakeFastAppleList(length, capacity int) *FastAppleList
MakeFastAppleList makes an empty list with both length and capacity initialised.
func NewFastAppleList ¶
func NewFastAppleList(values ...Apple) *FastAppleList
NewFastAppleList constructs a new list containing the supplied values, if any.
func (*FastAppleList) Add ¶
func (list *FastAppleList) Add(more ...Apple)
Add adds items to the current list. This is a synonym for Append.
func (*FastAppleList) Append ¶
func (list *FastAppleList) Append(more ...Apple) *FastAppleList
Append adds items to the current list. If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned.
func (*FastAppleList) Clone ¶
func (list *FastAppleList) Clone() *FastAppleList
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (*FastAppleList) Contains ¶
func (list *FastAppleList) Contains(v Apple) bool
Contains determines whether a given item is already in the list, returning true if so.
func (*FastAppleList) ContainsAll ¶
func (list *FastAppleList) ContainsAll(i ...Apple) 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 (*FastAppleList) CountBy ¶
func (list *FastAppleList) CountBy(p func(Apple) bool) (result int)
CountBy gives the number elements of FastAppleList that return true for the predicate p.
func (*FastAppleList) DistinctBy ¶
func (list *FastAppleList) DistinctBy(equal func(Apple, Apple) bool) *FastAppleList
DistinctBy returns a new FastAppleList whose elements are unique, where equality is defined by the equal function.
func (*FastAppleList) DoDeleteAt ¶
func (list *FastAppleList) DoDeleteAt(index, n int) *FastAppleList
DoDeleteAt modifies a FastAppleList by deleting n elements from a given index.
The list is modified and the modified list is returned. Panics if the index is out of range or n is large enough to take the index out of range.
func (*FastAppleList) DoDeleteFirst ¶
func (list *FastAppleList) DoDeleteFirst(n int) *FastAppleList
DoDeleteFirst modifies a FastAppleList by deleting n elements from the start of the list.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if n is large enough to take the index out of range.
func (*FastAppleList) DoDeleteLast ¶
func (list *FastAppleList) DoDeleteLast(n int) *FastAppleList
DoDeleteLast modifies a FastAppleList by deleting n elements from the end of the list.
The list is modified and the modified list is returned. Panics if n is large enough to take the index out of range.
func (*FastAppleList) DoInsertAt ¶
func (list *FastAppleList) DoInsertAt(index int, more ...Apple) *FastAppleList
DoInsertAt modifies a FastAppleList by inserting elements at a given index. This is a generalised version of Append.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if the index is out of range.
func (*FastAppleList) DoKeepWhere ¶
func (list *FastAppleList) DoKeepWhere(p func(Apple) bool) *FastAppleList
DoKeepWhere modifies a FastAppleList by retaining only those elements that match the predicate p. This is very similar to Filter but alters the list in place.
The list is modified and the modified list is returned.
func (*FastAppleList) DoReverse ¶
func (list *FastAppleList) DoReverse() *FastAppleList
DoReverse alters a FastAppleList 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 (*FastAppleList) DoShuffle ¶
func (list *FastAppleList) DoShuffle() *FastAppleList
DoShuffle returns a shuffled FastAppleList, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (*FastAppleList) Drop ¶
func (list *FastAppleList) Drop(n int) *FastAppleList
Drop returns a slice of FastAppleList 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 (*FastAppleList) DropLast ¶
func (list *FastAppleList) DropLast(n int) *FastAppleList
DropLast returns a slice of FastAppleList 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 (*FastAppleList) DropWhile ¶
func (list *FastAppleList) DropWhile(p func(Apple) bool) *FastAppleList
DropWhile returns a new FastAppleList 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 (*FastAppleList) Equals ¶
func (list *FastAppleList) Equals(other *FastAppleList) bool
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal. Nil lists are considered to be empty.
func (*FastAppleList) Exists ¶
func (list *FastAppleList) Exists(p func(Apple) bool) bool
Exists verifies that one or more elements of FastAppleList return true for the predicate p.
func (*FastAppleList) Filter ¶
func (list *FastAppleList) Filter(p func(Apple) bool) *FastAppleList
Filter returns a new FastAppleList whose elements return true for predicate p.
The original list is not modified. See also DoKeepWhere (which does modify the original list).
func (*FastAppleList) Find ¶
func (list *FastAppleList) Find(p func(Apple) bool) (Apple, bool)
Find returns the first Apple that returns true for predicate p. False is returned if none match.
func (*FastAppleList) FlatMap ¶
func (list *FastAppleList) FlatMap(f func(Apple) []Apple) *FastAppleList
FlatMap returns a new FastAppleList 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 (*FastAppleList) Fold ¶ added in v3.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (*FastAppleList) Forall ¶
func (list *FastAppleList) Forall(p func(Apple) bool) bool
Forall verifies that all elements of FastAppleList return true for the predicate p.
func (*FastAppleList) Foreach ¶
func (list *FastAppleList) Foreach(f func(Apple))
Foreach iterates over FastAppleList and executes function f against each element. The function can safely alter the values via side-effects.
func (*FastAppleList) Get ¶
func (list *FastAppleList) Get(i int) Apple
Get gets the specified element in the list. Panics if the index is out of range or the list is nil.
func (*FastAppleList) GobDecode ¶
func (list *FastAppleList) GobDecode(b []byte) error
GobDecode implements 'gob' decoding for this list type. You must register Apple with the 'gob' package before this method is used.
func (FastAppleList) GobEncode ¶
func (list FastAppleList) GobEncode() ([]byte, error)
GobEncode implements 'gob' encoding for this list type. You must register Apple with the 'gob' package before this method is used.
func (*FastAppleList) Head ¶
func (list *FastAppleList) Head() Apple
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 (*FastAppleList) HeadOption ¶
func (list *FastAppleList) HeadOption() (Apple, bool)
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (*FastAppleList) IndexWhere ¶
func (list *FastAppleList) IndexWhere(p func(Apple) bool) int
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (*FastAppleList) IndexWhere2 ¶
func (list *FastAppleList) IndexWhere2(p func(Apple) 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 (*FastAppleList) Init ¶
func (list *FastAppleList) Init() *FastAppleList
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 (*FastAppleList) IsEmpty ¶
func (list *FastAppleList) IsEmpty() bool
IsEmpty tests whether FastAppleList is empty.
func (*FastAppleList) IsSequence ¶
func (list *FastAppleList) IsSequence() bool
IsSequence returns true for lists and queues.
func (*FastAppleList) IsSet ¶
func (list *FastAppleList) IsSet() bool
IsSet returns false for lists or queues.
func (*FastAppleList) Last ¶
func (list *FastAppleList) Last() Apple
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 (*FastAppleList) LastIndexWhere ¶
func (list *FastAppleList) LastIndexWhere(p func(Apple) bool) int
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (*FastAppleList) LastIndexWhere2 ¶
func (list *FastAppleList) LastIndexWhere2(p func(Apple) 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 (*FastAppleList) LastOption ¶
func (list *FastAppleList) LastOption() (Apple, bool)
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (*FastAppleList) Len ¶
func (list *FastAppleList) 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 (*FastAppleList) Map ¶
func (list *FastAppleList) Map(f func(Apple) Apple) *FastAppleList
Map returns a new FastAppleList 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 (*FastAppleList) MaxBy ¶
func (list *FastAppleList) MaxBy(less func(Apple, Apple) bool) Apple
MaxBy returns an element of FastAppleList 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 (*FastAppleList) MinBy ¶
func (list *FastAppleList) MinBy(less func(Apple, Apple) bool) Apple
MinBy returns an element of FastAppleList 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 (*FastAppleList) NonEmpty ¶
func (list *FastAppleList) NonEmpty() bool
NonEmpty tests whether FastAppleList is empty.
func (*FastAppleList) Partition ¶
func (list *FastAppleList) Partition(p func(Apple) bool) (*FastAppleList, *FastAppleList)
Partition returns two new FastAppleLists 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 (*FastAppleList) Reverse ¶
func (list *FastAppleList) Reverse() *FastAppleList
Reverse returns a copy of FastAppleList with all elements in the reverse order.
The original list is not modified.
func (*FastAppleList) Send ¶
func (list *FastAppleList) Send() <-chan Apple
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 (*FastAppleList) Shuffle ¶
func (list *FastAppleList) Shuffle() *FastAppleList
Shuffle returns a shuffled copy of FastAppleList, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (*FastAppleList) Size ¶
func (list *FastAppleList) Size() int
Size returns the number of items in the list - an alias of Len().
func (*FastAppleList) SortBy ¶
func (list *FastAppleList) SortBy(less func(i, j Apple) bool) *FastAppleList
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (*FastAppleList) StableSortBy ¶
func (list *FastAppleList) StableSortBy(less func(i, j Apple) bool) *FastAppleList
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 (*FastAppleList) Swap ¶
func (list *FastAppleList) 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 (*FastAppleList) Tail ¶
func (list *FastAppleList) Tail() *FastAppleList
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 (*FastAppleList) Take ¶
func (list *FastAppleList) Take(n int) *FastAppleList
Take returns a slice of FastAppleList 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 (*FastAppleList) TakeLast ¶
func (list *FastAppleList) TakeLast(n int) *FastAppleList
TakeLast returns a slice of FastAppleList 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 (*FastAppleList) TakeWhile ¶
func (list *FastAppleList) TakeWhile(p func(Apple) bool) *FastAppleList
TakeWhile returns a new FastAppleList 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 (*FastAppleList) ToInterfaceSlice ¶
func (list *FastAppleList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (*FastAppleList) ToList ¶
func (list *FastAppleList) ToList() *FastAppleList
ToList returns the elements of the list as a list, which is an identity operation in this case.
func (*FastAppleList) ToSlice ¶
func (list *FastAppleList) ToSlice() []Apple
ToSlice returns the elements of the current list as a slice.
type FastAppleQueue ¶
type FastAppleQueue struct {
// contains filtered or unexported fields
}
FastAppleQueue is a ring buffer containing a slice of type Apple. It is optimised for FIFO operations.
func BuildFastAppleQueueFromChan ¶
func BuildFastAppleQueueFromChan(source <-chan Apple) *FastAppleQueue
BuildFastAppleQueueFromChan constructs a new FastAppleQueue from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func NewFastAppleQueue ¶
func NewFastAppleQueue(capacity int, overwrite bool) *FastAppleQueue
NewFastAppleQueue returns a new queue of Apple. 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 NewFastAppleSortedQueue ¶
func NewFastAppleSortedQueue(capacity int, overwrite bool, less func(i, j Apple) bool) *FastAppleQueue
NewFastAppleSortedQueue returns a new queue of Apple. 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 (*FastAppleQueue) Add ¶
func (queue *FastAppleQueue) Add(more ...Apple)
Add adds items to the queue. This is a synonym for Push.
func (*FastAppleQueue) Cap ¶
func (queue *FastAppleQueue) Cap() int
Cap gets the capacity of this queue.
func (*FastAppleQueue) Clone ¶
func (queue *FastAppleQueue) Clone() *FastAppleQueue
Clone returns a shallow copy of the queue. It does not clone the underlying elements.
func (*FastAppleQueue) CountBy ¶
func (queue *FastAppleQueue) CountBy(p func(Apple) bool) (result int)
CountBy gives the number elements of FastAppleQueue that return true for the predicate p.
func (*FastAppleQueue) DoKeepWhere ¶
func (queue *FastAppleQueue) DoKeepWhere(p func(Apple) bool) *FastAppleQueue
DoKeepWhere modifies a FastAppleQueue 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 (*FastAppleQueue) Exists ¶
func (queue *FastAppleQueue) Exists(p func(Apple) bool) bool
Exists verifies that one or more elements of FastAppleQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*FastAppleQueue) Filter ¶
func (queue *FastAppleQueue) Filter(p func(Apple) bool) *FastAppleQueue
Filter returns a new FastAppleQueue whose elements return true for predicate p.
The original queue is not modified. See also DoKeepWhere (which does modify the original queue).
func (*FastAppleQueue) Find ¶
func (queue *FastAppleQueue) Find(p func(Apple) bool) (Apple, bool)
Find returns the first Apple that returns true for predicate p. False is returned if none match.
func (*FastAppleQueue) FlatMap ¶
func (queue *FastAppleQueue) FlatMap(f func(Apple) []Apple) *FastAppleQueue
FlatMap returns a new FastAppleQueue 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 (*FastAppleQueue) Fold ¶ added in v3.9.0
Fold aggregates all the values in the queue using a supplied function, starting from some initial value.
func (*FastAppleQueue) Forall ¶
func (queue *FastAppleQueue) Forall(p func(Apple) bool) bool
Forall verifies that all elements of FastAppleQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*FastAppleQueue) Foreach ¶
func (queue *FastAppleQueue) Foreach(f func(Apple))
Foreach iterates over FastAppleQueue and executes function f against each element. The function can safely alter the values via side-effects.
func (*FastAppleQueue) Get ¶
func (queue *FastAppleQueue) Get(i int) Apple
Get gets the specified element in the queue. Panics if the index is out of range or the queue is nil.
func (*FastAppleQueue) Head ¶
func (queue *FastAppleQueue) Head() Apple
Head gets the first element in the queue. Head is the opposite of Last. Panics if queue is empty or nil.
func (*FastAppleQueue) HeadOption ¶
func (queue *FastAppleQueue) HeadOption() (Apple, 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 (*FastAppleQueue) IsEmpty ¶
func (queue *FastAppleQueue) IsEmpty() bool
IsEmpty returns true if the queue is empty.
func (*FastAppleQueue) IsFull ¶
func (queue *FastAppleQueue) IsFull() bool
IsFull returns true if the queue is full.
func (*FastAppleQueue) IsOverwriting ¶
func (queue *FastAppleQueue) IsOverwriting() bool
IsOverwriting returns true if the queue is overwriting, false if refusing.
func (*FastAppleQueue) IsSequence ¶
func (queue *FastAppleQueue) IsSequence() bool
IsSequence returns true for ordered lists and queues.
func (*FastAppleQueue) IsSet ¶
func (queue *FastAppleQueue) IsSet() bool
IsSet returns false for lists or queues.
func (*FastAppleQueue) Last ¶
func (queue *FastAppleQueue) Last() Apple
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 (*FastAppleQueue) LastOption ¶
func (queue *FastAppleQueue) LastOption() (Apple, 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 (*FastAppleQueue) Len ¶
func (queue *FastAppleQueue) Len() int
Len gets the current length of this queue. This is an alias for Size.
func (*FastAppleQueue) Less ¶
func (queue *FastAppleQueue) 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 (*FastAppleQueue) Map ¶
func (queue *FastAppleQueue) Map(f func(Apple) Apple) *FastAppleQueue
Map returns a new FastAppleQueue 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 (*FastAppleQueue) MaxBy ¶
func (queue *FastAppleQueue) MaxBy(less func(Apple, Apple) bool) Apple
MaxBy returns an element of FastAppleQueue 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 (*FastAppleQueue) MinBy ¶
func (queue *FastAppleQueue) MinBy(less func(Apple, Apple) bool) Apple
MinBy returns an element of FastAppleQueue 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 (*FastAppleQueue) NonEmpty ¶
func (queue *FastAppleQueue) NonEmpty() bool
NonEmpty returns true if the queue is not empty.
func (*FastAppleQueue) Offer ¶
func (queue *FastAppleQueue) Offer(items ...Apple) []Apple
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 (*FastAppleQueue) Partition ¶
func (queue *FastAppleQueue) Partition(p func(Apple) bool) (*FastAppleQueue, *FastAppleQueue)
Partition returns two new FastAppleQueues 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 (*FastAppleQueue) Pop ¶
func (queue *FastAppleQueue) Pop(n int) []Apple
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 (*FastAppleQueue) Pop1 ¶
func (queue *FastAppleQueue) Pop1() (Apple, 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 (*FastAppleQueue) Push ¶
func (queue *FastAppleQueue) Push(items ...Apple) *FastAppleQueue
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 (*FastAppleQueue) Reallocate ¶
func (queue *FastAppleQueue) Reallocate(capacity int, overwrite bool) *FastAppleQueue
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 (*FastAppleQueue) Send ¶
func (queue *FastAppleQueue) Send() <-chan Apple
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 (*FastAppleQueue) Size ¶
func (queue *FastAppleQueue) Size() int
Size gets the number of elements currently in this queue. This is an alias for Len.
func (*FastAppleQueue) Sort ¶
func (queue *FastAppleQueue) 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 NewFastAppleSortedQueue).
func (*FastAppleQueue) Space ¶
func (queue *FastAppleQueue) Space() int
Space returns the space available in the queue.
func (*FastAppleQueue) StableSort ¶
func (queue *FastAppleQueue) 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 NewFastAppleSortedQueue).
func (*FastAppleQueue) Swap ¶
func (queue *FastAppleQueue) Swap(i, j int)
Swap swaps the elements with indexes i and j. The queue must not be empty.
func (*FastAppleQueue) ToInterfaceSlice ¶
func (queue *FastAppleQueue) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the queue as a slice of arbitrary type. The queue is not altered.
func (*FastAppleQueue) ToSlice ¶
func (queue *FastAppleQueue) ToSlice() []Apple
ToSlice returns the elements of the queue as a slice. The queue is not altered.
type FastAppleSequence ¶ added in v3.9.0
type FastAppleSequence interface { FastAppleCollection // Head gets the first element in the sequence. Head plus Tail include the whole sequence. Head is the opposite of Last. Head() Apple // HeadOption gets the first element in the sequence, if possible. HeadOption() (Apple, bool) // Last gets the last element in the sequence. Init plus Last include the whole sequence. Last is the opposite of Head. Last() Apple // LastOption gets the last element in the sequence, if possible. LastOption() (Apple, bool) }
FastAppleSequence defines an interface for sequence methods on Apple.
type FastAppleSet ¶
type FastAppleSet struct {
// contains filtered or unexported fields
}
FastAppleSet is the primary type that represents a set.
func BuildFastAppleSetFromChan ¶
func BuildFastAppleSetFromChan(source <-chan Apple) *FastAppleSet
BuildFastAppleSetFromChan constructs a new FastAppleSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertFastAppleSet ¶
func ConvertFastAppleSet(values ...interface{}) (*FastAppleSet, bool)
ConvertFastAppleSet 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 NewFastAppleSet ¶
func NewFastAppleSet(values ...Apple) *FastAppleSet
NewFastAppleSet creates and returns a reference to an empty set.
func (*FastAppleSet) Add ¶
func (set *FastAppleSet) Add(more ...Apple)
Add adds items to the current set.
func (*FastAppleSet) Cardinality ¶
func (set *FastAppleSet) Cardinality() int
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*FastAppleSet) Clear ¶
func (set *FastAppleSet) Clear()
Clear the entire set. Aterwards, it will be an empty set.
func (*FastAppleSet) Clone ¶
func (set *FastAppleSet) Clone() *FastAppleSet
Clone returns a shallow copy of the set. It does not clone the underlying elements.
func (*FastAppleSet) Contains ¶
func (set *FastAppleSet) Contains(i Apple) bool
Contains determines whether a given item is already in the set, returning true if so.
func (*FastAppleSet) ContainsAll ¶
func (set *FastAppleSet) ContainsAll(i ...Apple) bool
ContainsAll determines whether the given items are all in the set, returning true if so.
func (*FastAppleSet) CountBy ¶
func (set *FastAppleSet) CountBy(p func(Apple) bool) (result int)
CountBy gives the number elements of FastAppleSet that return true for the predicate p.
func (*FastAppleSet) Difference ¶
func (set *FastAppleSet) Difference(other *FastAppleSet) *FastAppleSet
Difference returns a new set with items in the current set but not in the other set
func (*FastAppleSet) Equals ¶
func (set *FastAppleSet) Equals(other *FastAppleSet) bool
Equals determines whether two sets are equal to each other, returning true if so. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal.
func (*FastAppleSet) Exists ¶
func (set *FastAppleSet) Exists(p func(Apple) bool) bool
Exists applies a predicate p to every element in the set. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (*FastAppleSet) Filter ¶
func (set *FastAppleSet) Filter(p func(Apple) bool) *FastAppleSet
Filter returns a new FastAppleSet whose elements return true for the predicate p.
The original set is not modified
func (*FastAppleSet) Find ¶
func (set *FastAppleSet) Find(p func(Apple) bool) (Apple, bool)
Find returns the first Apple that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.
func (*FastAppleSet) FlatMap ¶
func (set *FastAppleSet) FlatMap(f func(Apple) []Apple) *FastAppleSet
FlatMap returns a new FastAppleSet 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 (*FastAppleSet) Fold ¶ added in v3.9.0
Fold aggregates all the values in the set using a supplied function, starting from some initial value.
func (*FastAppleSet) Forall ¶
func (set *FastAppleSet) Forall(p func(Apple) bool) bool
Forall applies a predicate function p to every element in the set. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (*FastAppleSet) Foreach ¶
func (set *FastAppleSet) Foreach(f func(Apple))
Foreach iterates over the set and executes the function f against each element. The function can safely alter the values via side-effects.
func (*FastAppleSet) GobDecode ¶
func (set *FastAppleSet) GobDecode(b []byte) error
GobDecode implements 'gob' decoding for this set type. You must register Apple with the 'gob' package before this method is used.
func (FastAppleSet) GobEncode ¶
func (set FastAppleSet) GobEncode() ([]byte, error)
GobEncode implements 'gob' encoding for this list type. You must register Apple with the 'gob' package before this method is used.
func (*FastAppleSet) Intersect ¶
func (set *FastAppleSet) Intersect(other *FastAppleSet) *FastAppleSet
Intersect returns a new set with items that exist only in both sets.
func (*FastAppleSet) IsEmpty ¶
func (set *FastAppleSet) IsEmpty() bool
IsEmpty returns true if the set is empty.
func (*FastAppleSet) IsSequence ¶
func (set *FastAppleSet) IsSequence() bool
IsSequence returns true for lists and queues.
func (*FastAppleSet) IsSet ¶
func (set *FastAppleSet) IsSet() bool
IsSet returns false for lists or queues.
func (*FastAppleSet) IsSubset ¶
func (set *FastAppleSet) IsSubset(other *FastAppleSet) bool
IsSubset determines whether every item in the other set is in this set, returning true if so.
func (*FastAppleSet) IsSuperset ¶
func (set *FastAppleSet) IsSuperset(other *FastAppleSet) bool
IsSuperset determines whether every item of this set is in the other set, returning true if so.
func (*FastAppleSet) Map ¶
func (set *FastAppleSet) Map(f func(Apple) Apple) *FastAppleSet
Map returns a new FastAppleSet 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 (*FastAppleSet) MaxBy ¶
func (set *FastAppleSet) MaxBy(less func(Apple, Apple) bool) Apple
MaxBy returns an element of FastAppleSet 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 (*FastAppleSet) MinBy ¶
func (set *FastAppleSet) MinBy(less func(Apple, Apple) bool) Apple
MinBy returns an element of FastAppleSet 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 (*FastAppleSet) NonEmpty ¶
func (set *FastAppleSet) NonEmpty() bool
NonEmpty returns true if the set is not empty.
func (*FastAppleSet) Partition ¶
func (set *FastAppleSet) Partition(p func(Apple) bool) (*FastAppleSet, *FastAppleSet)
Partition returns two new FastAppleSets whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list.
The original set is not modified
func (*FastAppleSet) Remove ¶
func (set *FastAppleSet) Remove(i Apple)
Remove a single item from the set.
func (*FastAppleSet) Send ¶
func (set *FastAppleSet) Send() <-chan Apple
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 (*FastAppleSet) Size ¶
func (set *FastAppleSet) Size() int
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (*FastAppleSet) SymmetricDifference ¶
func (set *FastAppleSet) SymmetricDifference(other *FastAppleSet) *FastAppleSet
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (*FastAppleSet) ToInterfaceSlice ¶
func (set *FastAppleSet) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.
func (*FastAppleSet) ToSet ¶
func (set *FastAppleSet) ToSet() *FastAppleSet
ToSet returns the set; this is an identity operation in this case.
func (*FastAppleSet) ToSlice ¶
func (set *FastAppleSet) ToSlice() []Apple
ToSlice returns the elements of the current set as a slice.
func (*FastAppleSet) Union ¶
func (set *FastAppleSet) Union(other *FastAppleSet) *FastAppleSet
Union returns a new set with all items in both sets.
type FastAppleSizer ¶
type FastAppleSizer interface { // IsEmpty tests whether FastAppleCollection is empty. IsEmpty() bool // NonEmpty tests whether FastAppleCollection is empty. NonEmpty() bool // Size returns the number of items in the collection - an alias of Len(). Size() int }
FastAppleSizer defines an interface for sizing methods on Apple collections.
type FastIntCollection ¶
type FastIntCollection interface { FastIntSizer FastIntMkStringer // 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 FastIntCollection return true for the predicate p. Exists(p func(int) bool) bool // Forall verifies that all elements of FastIntCollection return true for the predicate p. Forall(p func(int) bool) bool // Foreach iterates over FastIntCollection 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 FastIntCollection 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 // Clear the entire collection. Clear() // Add adds items to the current collection. Add(more ...int) // 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 FastIntCollection 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 FastIntCollection 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 }
FastIntCollection defines an interface for common collection methods on int.
type FastIntIntMap ¶
type FastIntIntMap struct {
// contains filtered or unexported fields
}
FastIntIntMap is the primary type that represents a thread-safe map
func NewFastIntIntMap ¶
func NewFastIntIntMap(kv ...FastIntIntTuple) *FastIntIntMap
NewFastIntIntMap creates and returns a reference to a map, optionally containing some items.
func NewFastIntIntMap1 ¶
func NewFastIntIntMap1(k int, v int) *FastIntIntMap
NewFastIntIntMap1 creates and returns a reference to a map containing one item.
func (*FastIntIntMap) Clone ¶
func (mm *FastIntIntMap) Clone() *FastIntIntMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (*FastIntIntMap) ContainsAllKeys ¶
func (mm *FastIntIntMap) ContainsAllKeys(kk ...int) bool
ContainsAllKeys determines if the given items are all in the map.
func (*FastIntIntMap) ContainsKey ¶
func (mm *FastIntIntMap) ContainsKey(k int) bool
ContainsKey determines if a given item is already in the map.
func (*FastIntIntMap) DropWhere ¶
func (mm *FastIntIntMap) DropWhere(fn func(int, int) bool) FastIntIntTuples
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 (*FastIntIntMap) Equals ¶
func (mm *FastIntIntMap) Equals(other *FastIntIntMap) 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 (*FastIntIntMap) Exists ¶
func (mm *FastIntIntMap) Exists(p func(int, int) bool) bool
Exists applies the predicate p to every element in the map. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (*FastIntIntMap) Filter ¶
func (mm *FastIntIntMap) Filter(p func(int, int) bool) *FastIntIntMap
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 (*FastIntIntMap) Find ¶
func (mm *FastIntIntMap) Find(p func(int, int) bool) (FastIntIntTuple, 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 (*FastIntIntMap) FlatMap ¶
func (mm *FastIntIntMap) FlatMap(f func(int, int) []FastIntIntTuple) *FastIntIntMap
FlatMap returns a new FastIntMap 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 (*FastIntIntMap) Forall ¶
func (mm *FastIntIntMap) Forall(p func(int, int) bool) bool
Forall applies the predicate p to every element in the map. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (*FastIntIntMap) Foreach ¶
func (mm *FastIntIntMap) Foreach(f func(int, int))
Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.
func (*FastIntIntMap) Get ¶
func (mm *FastIntIntMap) Get(k int) (int, bool)
Get returns one of the items in the map, if present.
func (*FastIntIntMap) IsEmpty ¶
func (mm *FastIntIntMap) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (*FastIntIntMap) Keys ¶
func (mm *FastIntIntMap) Keys() []int
Keys returns the keys of the current map as a slice.
func (*FastIntIntMap) Map ¶
func (mm *FastIntIntMap) Map(f func(int, int) (int, int)) *FastIntIntMap
Map returns a new FastIntMap 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 (*FastIntIntMap) MkString ¶
func (mm *FastIntIntMap) MkString(sep string) string
MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.
func (*FastIntIntMap) MkString4 ¶ added in v3.7.0
func (mm *FastIntIntMap) MkString4(before, between, after, equals string) string
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (*FastIntIntMap) NonEmpty ¶
func (mm *FastIntIntMap) NonEmpty() bool
NonEmpty returns true if the map is not empty.
func (*FastIntIntMap) OrderedSlice ¶ added in v3.6.0
func (mm *FastIntIntMap) OrderedSlice(keys []int) FastIntIntTuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (*FastIntIntMap) Partition ¶
func (mm *FastIntIntMap) Partition(p func(int, int) bool) (matching *FastIntIntMap, others *FastIntIntMap)
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 (*FastIntIntMap) Pop ¶
func (mm *FastIntIntMap) Pop(k int) (int, bool)
Pop removes a single item from the map, returning the value present prior to removal. The boolean result is true only if the key had been present.
func (*FastIntIntMap) Put ¶
func (mm *FastIntIntMap) Put(k int, v int) bool
Put adds an item to the current map, replacing any prior value.
func (*FastIntIntMap) Remove ¶
func (mm *FastIntIntMap) Remove(k int)
Remove a single item from the map.
func (*FastIntIntMap) Size ¶
func (mm *FastIntIntMap) Size() int
Size returns how many items are currently in the map. This is a synonym for Len.
func (*FastIntIntMap) String ¶
func (mm *FastIntIntMap) String() string
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (*FastIntIntMap) ToSlice ¶
func (mm *FastIntIntMap) ToSlice() FastIntIntTuples
ToSlice returns the key/value pairs as a slice
func (*FastIntIntMap) Values ¶
func (mm *FastIntIntMap) Values() []int
Values returns the values of the current map as a slice.
type FastIntIntTuple ¶
FastIntIntTuple represents a key/value pair.
func (FastIntIntTuple) MarshalJSON ¶ added in v3.6.0
func (t FastIntIntTuple) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding.Marshaler interface.
func (FastIntIntTuple) UnmarshalJSON ¶ added in v3.6.0
func (t FastIntIntTuple) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this tuple type.
type FastIntIntTuples ¶
type FastIntIntTuples []FastIntIntTuple
FastIntIntTuples can be used as a builder for unmodifiable maps.
func FastIntIntZip ¶
func FastIntIntZip(keys ...int) FastIntIntTuples
FastIntIntZip 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 NewFastIntIntMap constructor function.
func (FastIntIntTuples) Append1 ¶
func (ts FastIntIntTuples) Append1(k int, v int) FastIntIntTuples
Append1 adds one item.
func (FastIntIntTuples) Append2 ¶
func (ts FastIntIntTuples) Append2(k1 int, v1 int, k2 int, v2 int) FastIntIntTuples
Append2 adds two items.
func (FastIntIntTuples) Append3 ¶
func (ts FastIntIntTuples) Append3(k1 int, v1 int, k2 int, v2 int, k3 int, v3 int) FastIntIntTuples
Append3 adds three items.
func (FastIntIntTuples) MkString ¶ added in v3.6.0
func (ts FastIntIntTuples) MkString(sep string) string
MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.
func (FastIntIntTuples) MkString4 ¶ added in v3.7.0
func (ts FastIntIntTuples) MkString4(before, between, after, equals string) string
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (FastIntIntTuples) String ¶ added in v3.6.0
func (ts FastIntIntTuples) String() string
func (FastIntIntTuples) ToMap ¶ added in v3.6.0
func (ts FastIntIntTuples) ToMap() *FastIntIntMap
ToMap converts the tuples to a map.
func (FastIntIntTuples) Values ¶
func (ts FastIntIntTuples) Values(values ...int) FastIntIntTuples
Values sets the values in a tuple slice. Use this with FastIntIntZip.
type FastIntList ¶
type FastIntList struct {
// contains filtered or unexported fields
}
FastIntList contains a slice of type int. It encapsulates the slice and provides methods to access or mutate it.
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 BuildFastIntListFromChan ¶
func BuildFastIntListFromChan(source <-chan int) *FastIntList
BuildFastIntListFromChan constructs a new FastIntList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertFastIntList ¶
func ConvertFastIntList(values ...interface{}) (*FastIntList, bool)
ConvertFastIntList 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 MakeFastIntList ¶
func MakeFastIntList(length, capacity int) *FastIntList
MakeFastIntList makes an empty list with both length and capacity initialised.
func NewFastIntList ¶
func NewFastIntList(values ...int) *FastIntList
NewFastIntList constructs a new list containing the supplied values, if any.
func (*FastIntList) Add ¶
func (list *FastIntList) Add(more ...int)
Add adds items to the current list. This is a synonym for Append.
func (*FastIntList) Append ¶
func (list *FastIntList) Append(more ...int) *FastIntList
Append adds items to the current list. If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned.
func (*FastIntList) Clone ¶
func (list *FastIntList) Clone() *FastIntList
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (*FastIntList) Contains ¶
func (list *FastIntList) Contains(v int) bool
Contains determines whether a given item is already in the list, returning true if so.
func (*FastIntList) ContainsAll ¶
func (list *FastIntList) ContainsAll(i ...int) bool
ContainsAll determines whether the given items are all in the list, returning true if so. This is potentially a slow method and should only be used rarely.
func (*FastIntList) CountBy ¶
func (list *FastIntList) CountBy(p func(int) bool) (result int)
CountBy gives the number elements of FastIntList that return true for the predicate p.
func (*FastIntList) DistinctBy ¶
func (list *FastIntList) DistinctBy(equal func(int, int) bool) *FastIntList
DistinctBy returns a new FastIntList whose elements are unique, where equality is defined by the equal function.
func (*FastIntList) DoDeleteAt ¶
func (list *FastIntList) DoDeleteAt(index, n int) *FastIntList
DoDeleteAt modifies a FastIntList by deleting n elements from a given index.
The list is modified and the modified list is returned. Panics if the index is out of range or n is large enough to take the index out of range.
func (*FastIntList) DoDeleteFirst ¶
func (list *FastIntList) DoDeleteFirst(n int) *FastIntList
DoDeleteFirst modifies a FastIntList by deleting n elements from the start of the list.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if n is large enough to take the index out of range.
func (*FastIntList) DoDeleteLast ¶
func (list *FastIntList) DoDeleteLast(n int) *FastIntList
DoDeleteLast modifies a FastIntList by deleting n elements from the end of the list.
The list is modified and the modified list is returned. Panics if n is large enough to take the index out of range.
func (*FastIntList) DoInsertAt ¶
func (list *FastIntList) DoInsertAt(index int, more ...int) *FastIntList
DoInsertAt modifies a FastIntList by inserting elements at a given index. This is a generalised version of Append.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if the index is out of range.
func (*FastIntList) DoKeepWhere ¶
func (list *FastIntList) DoKeepWhere(p func(int) bool) *FastIntList
DoKeepWhere modifies a FastIntList by retaining only those elements that match the predicate p. This is very similar to Filter but alters the list in place.
The list is modified and the modified list is returned.
func (*FastIntList) DoReverse ¶
func (list *FastIntList) DoReverse() *FastIntList
DoReverse alters a FastIntList 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 (*FastIntList) DoShuffle ¶
func (list *FastIntList) DoShuffle() *FastIntList
DoShuffle returns a shuffled FastIntList, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (*FastIntList) Drop ¶
func (list *FastIntList) Drop(n int) *FastIntList
Drop returns a slice of FastIntList 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 (*FastIntList) DropLast ¶
func (list *FastIntList) DropLast(n int) *FastIntList
DropLast returns a slice of FastIntList 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 (*FastIntList) DropWhile ¶
func (list *FastIntList) DropWhile(p func(int) bool) *FastIntList
DropWhile returns a new FastIntList 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 (*FastIntList) Equals ¶
func (list *FastIntList) Equals(other *FastIntList) bool
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal. Nil lists are considered to be empty.
func (*FastIntList) Exists ¶
func (list *FastIntList) Exists(p func(int) bool) bool
Exists verifies that one or more elements of FastIntList return true for the predicate p.
func (*FastIntList) Filter ¶
func (list *FastIntList) Filter(p func(int) bool) *FastIntList
Filter returns a new FastIntList whose elements return true for predicate p.
The original list is not modified. See also DoKeepWhere (which does modify the original list).
func (*FastIntList) Find ¶
func (list *FastIntList) Find(p func(int) bool) (int, bool)
Find returns the first int that returns true for predicate p. False is returned if none match.
func (*FastIntList) FlatMap ¶
func (list *FastIntList) FlatMap(f func(int) []int) *FastIntList
FlatMap returns a new FastIntList 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 (*FastIntList) FlatMapToInt64 ¶
func (list *FastIntList) FlatMapToInt64(f func(int) []int64) []int64
FlatMapToInt64 returns a new []int64 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 (*FastIntList) FlatMapToString ¶
func (list *FastIntList) FlatMapToString(f func(int) []string) []string
FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the list. 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 (*FastIntList) Fold ¶ added in v3.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (*FastIntList) Forall ¶
func (list *FastIntList) Forall(p func(int) bool) bool
Forall verifies that all elements of FastIntList return true for the predicate p.
func (*FastIntList) Foreach ¶
func (list *FastIntList) Foreach(f func(int))
Foreach iterates over FastIntList and executes function f against each element. The function can safely alter the values via side-effects.
func (*FastIntList) Get ¶
func (list *FastIntList) Get(i int) int
Get gets the specified element in the list. Panics if the index is out of range or the list is nil.
func (*FastIntList) Head ¶
func (list *FastIntList) Head() int
Head gets the first element in the list. Head plus Tail include the whole list. Head is the opposite of Last. Panics if list is empty or nil.
func (*FastIntList) HeadOption ¶
func (list *FastIntList) HeadOption() (int, bool)
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (*FastIntList) IndexWhere ¶
func (list *FastIntList) IndexWhere(p func(int) bool) int
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (*FastIntList) IndexWhere2 ¶
func (list *FastIntList) IndexWhere2(p func(int) bool, from int) int
IndexWhere2 finds the index of the first element satisfying predicate p at or after some start index. If none exists, -1 is returned.
func (*FastIntList) Init ¶
func (list *FastIntList) Init() *FastIntList
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 (*FastIntList) IsEmpty ¶
func (list *FastIntList) IsEmpty() bool
IsEmpty tests whether FastIntList is empty.
func (*FastIntList) IsSequence ¶
func (list *FastIntList) IsSequence() bool
IsSequence returns true for lists and queues.
func (*FastIntList) IsSet ¶
func (list *FastIntList) IsSet() bool
IsSet returns false for lists or queues.
func (*FastIntList) Last ¶
func (list *FastIntList) Last() int
Last gets the last element in the list. Init plus Last include the whole list. Last is the opposite of Head. Panics if list is empty or nil.
func (*FastIntList) LastIndexWhere ¶
func (list *FastIntList) LastIndexWhere(p func(int) bool) int
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (*FastIntList) LastIndexWhere2 ¶
func (list *FastIntList) LastIndexWhere2(p func(int) bool, before int) int
LastIndexWhere2 finds the index of the last element satisfying predicate p at or before some start index. If none exists, -1 is returned.
func (*FastIntList) LastOption ¶
func (list *FastIntList) LastOption() (int, bool)
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (*FastIntList) Len ¶
func (list *FastIntList) 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 (*FastIntList) Map ¶
func (list *FastIntList) Map(f func(int) int) *FastIntList
Map returns a new FastIntList 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 (*FastIntList) MapToInt64 ¶
func (list *FastIntList) MapToInt64(f func(int) int64) []int64
MapToInt64 returns a new []int64 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 (*FastIntList) MapToString ¶
func (list *FastIntList) MapToString(f func(int) string) []string
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the list. 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 (FastIntList) MarshalJSON ¶
func (list FastIntList) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this list type.
func (*FastIntList) Max ¶
func (list *FastIntList) Max() (result int)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (*FastIntList) MaxBy ¶
func (list *FastIntList) MaxBy(less func(int, int) bool) int
MaxBy returns an element of FastIntList 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 (*FastIntList) Min ¶
func (list *FastIntList) Min() int
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (*FastIntList) MinBy ¶
func (list *FastIntList) MinBy(less func(int, int) bool) int
MinBy returns an element of FastIntList 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 (*FastIntList) MkString ¶
func (list *FastIntList) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*FastIntList) MkString3 ¶
func (list *FastIntList) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*FastIntList) NonEmpty ¶
func (list *FastIntList) NonEmpty() bool
NonEmpty tests whether FastIntList is empty.
func (*FastIntList) Partition ¶
func (list *FastIntList) Partition(p func(int) bool) (*FastIntList, *FastIntList)
Partition returns two new FastIntLists 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 (*FastIntList) Reverse ¶
func (list *FastIntList) Reverse() *FastIntList
Reverse returns a copy of FastIntList with all elements in the reverse order.
The original list is not modified.
func (*FastIntList) Send ¶
func (list *FastIntList) Send() <-chan int
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed. The channel will be closed when all the elements have been sent.
func (*FastIntList) Shuffle ¶
func (list *FastIntList) Shuffle() *FastIntList
Shuffle returns a shuffled copy of FastIntList, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (*FastIntList) Size ¶
func (list *FastIntList) Size() int
Size returns the number of items in the list - an alias of Len().
func (*FastIntList) SortBy ¶
func (list *FastIntList) SortBy(less func(i, j int) bool) *FastIntList
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (*FastIntList) Sorted ¶
func (list *FastIntList) Sorted() *FastIntList
Sorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (*FastIntList) StableSortBy ¶
func (list *FastIntList) StableSortBy(less func(i, j int) bool) *FastIntList
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 (*FastIntList) StableSorted ¶
func (list *FastIntList) StableSorted() *FastIntList
StableSorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (*FastIntList) String ¶
func (list *FastIntList) String() string
String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.
func (*FastIntList) StringList ¶
func (list *FastIntList) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (*FastIntList) Sum ¶
func (list *FastIntList) Sum() int
Sum returns the sum of all the elements in the list.
func (*FastIntList) Swap ¶
func (list *FastIntList) 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 (*FastIntList) Tail ¶
func (list *FastIntList) Tail() *FastIntList
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 (*FastIntList) Take ¶
func (list *FastIntList) Take(n int) *FastIntList
Take returns a slice of FastIntList 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 (*FastIntList) TakeLast ¶
func (list *FastIntList) TakeLast(n int) *FastIntList
TakeLast returns a slice of FastIntList 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 (*FastIntList) TakeWhile ¶
func (list *FastIntList) TakeWhile(p func(int) bool) *FastIntList
TakeWhile returns a new FastIntList 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 (*FastIntList) ToInterfaceSlice ¶
func (list *FastIntList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (*FastIntList) ToList ¶
func (list *FastIntList) ToList() *FastIntList
ToList returns the elements of the list as a list, which is an identity operation in this case.
func (*FastIntList) ToSlice ¶
func (list *FastIntList) ToSlice() []int
ToSlice returns the elements of the current list as a slice.
func (*FastIntList) UnmarshalJSON ¶
func (list *FastIntList) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this list type.
type FastIntMkStringer ¶
type FastIntMkStringer 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 // implements json.Marshaler interface { MarshalJSON() ([]byte, error) // implements json.Unmarshaler interface { UnmarshalJSON(b []byte) error // StringList gets a collection of strings that depicts all the elements. StringList() []string }
FastIntMkStringer defines an interface for stringer methods on int collections.
type FastIntQueue ¶
type FastIntQueue struct {
// contains filtered or unexported fields
}
FastIntQueue is a ring buffer containing a slice of type int. It is optimised for FIFO operations.
func BuildFastIntQueueFromChan ¶
func BuildFastIntQueueFromChan(source <-chan int) *FastIntQueue
BuildFastIntQueueFromChan constructs a new FastIntQueue from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func NewFastIntQueue ¶
func NewFastIntQueue(capacity int, overwrite bool) *FastIntQueue
NewFastIntQueue 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 NewFastIntSortedQueue ¶
func NewFastIntSortedQueue(capacity int, overwrite bool, less func(i, j int) bool) *FastIntQueue
NewFastIntSortedQueue 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 (*FastIntQueue) Add ¶
func (queue *FastIntQueue) Add(more ...int)
Add adds items to the queue. This is a synonym for Push.
func (*FastIntQueue) Cap ¶
func (queue *FastIntQueue) Cap() int
Cap gets the capacity of this queue.
func (*FastIntQueue) Clone ¶
func (queue *FastIntQueue) Clone() *FastIntQueue
Clone returns a shallow copy of the queue. It does not clone the underlying elements.
func (*FastIntQueue) CountBy ¶
func (queue *FastIntQueue) CountBy(p func(int) bool) (result int)
CountBy gives the number elements of FastIntQueue that return true for the predicate p.
func (*FastIntQueue) DoKeepWhere ¶
func (queue *FastIntQueue) DoKeepWhere(p func(int) bool) *FastIntQueue
DoKeepWhere modifies a FastIntQueue 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 (*FastIntQueue) Exists ¶
func (queue *FastIntQueue) Exists(p func(int) bool) bool
Exists verifies that one or more elements of FastIntQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*FastIntQueue) Filter ¶
func (queue *FastIntQueue) Filter(p func(int) bool) *FastIntQueue
Filter returns a new FastIntQueue whose elements return true for predicate p.
The original queue is not modified. See also DoKeepWhere (which does modify the original queue).
func (*FastIntQueue) Find ¶
func (queue *FastIntQueue) Find(p func(int) bool) (int, bool)
Find returns the first int that returns true for predicate p. False is returned if none match.
func (*FastIntQueue) FlatMap ¶
func (queue *FastIntQueue) FlatMap(f func(int) []int) *FastIntQueue
FlatMap returns a new FastIntQueue 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 (*FastIntQueue) FlatMapToInt64 ¶
func (queue *FastIntQueue) FlatMapToInt64(f func(int) []int64) []int64
FlatMapToInt64 returns a new []int64 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 (*FastIntQueue) FlatMapToString ¶
func (queue *FastIntQueue) FlatMapToString(f func(int) []string) []string
FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the 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 (*FastIntQueue) Fold ¶ added in v3.9.0
Fold aggregates all the values in the queue using a supplied function, starting from some initial value.
func (*FastIntQueue) Forall ¶
func (queue *FastIntQueue) Forall(p func(int) bool) bool
Forall verifies that all elements of FastIntQueue return true for the predicate p. The function should not alter the values via side-effects.
func (*FastIntQueue) Foreach ¶
func (queue *FastIntQueue) Foreach(f func(int))
Foreach iterates over FastIntQueue and executes function f against each element. The function can safely alter the values via side-effects.
func (*FastIntQueue) Get ¶
func (queue *FastIntQueue) Get(i int) int
Get gets the specified element in the queue. Panics if the index is out of range or the queue is nil.
func (*FastIntQueue) Head ¶
func (queue *FastIntQueue) Head() int
Head gets the first element in the queue. Head is the opposite of Last. Panics if queue is empty or nil.
func (*FastIntQueue) HeadOption ¶
func (queue *FastIntQueue) HeadOption() (int, 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 (*FastIntQueue) IsEmpty ¶
func (queue *FastIntQueue) IsEmpty() bool
IsEmpty returns true if the queue is empty.
func (*FastIntQueue) IsFull ¶
func (queue *FastIntQueue) IsFull() bool
IsFull returns true if the queue is full.
func (*FastIntQueue) IsOverwriting ¶
func (queue *FastIntQueue) IsOverwriting() bool
IsOverwriting returns true if the queue is overwriting, false if refusing.
func (*FastIntQueue) IsSequence ¶
func (queue *FastIntQueue) IsSequence() bool
IsSequence returns true for ordered lists and queues.
func (*FastIntQueue) IsSet ¶
func (queue *FastIntQueue) IsSet() bool
IsSet returns false for lists or queues.
func (*FastIntQueue) Last ¶
func (queue *FastIntQueue) Last() int
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 (*FastIntQueue) LastOption ¶
func (queue *FastIntQueue) LastOption() (int, 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 (*FastIntQueue) Len ¶
func (queue *FastIntQueue) Len() int
Len gets the current length of this queue. This is an alias for Size.
func (*FastIntQueue) Less ¶
func (queue *FastIntQueue) 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 (*FastIntQueue) Map ¶
func (queue *FastIntQueue) Map(f func(int) int) *FastIntQueue
Map returns a new FastIntQueue 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 (*FastIntQueue) MapToInt64 ¶
func (queue *FastIntQueue) MapToInt64(f func(int) int64) []int64
MapToInt64 returns a new []int64 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 (*FastIntQueue) MapToString ¶
func (queue *FastIntQueue) MapToString(f func(int) string) []string
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the 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 (*FastIntQueue) MaxBy ¶
func (queue *FastIntQueue) MaxBy(less func(int, int) bool) int
MaxBy returns an element of FastIntQueue 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 (*FastIntQueue) MinBy ¶
func (queue *FastIntQueue) MinBy(less func(int, int) bool) int
MinBy returns an element of FastIntQueue 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 (*FastIntQueue) NonEmpty ¶
func (queue *FastIntQueue) NonEmpty() bool
NonEmpty returns true if the queue is not empty.
func (*FastIntQueue) Offer ¶
func (queue *FastIntQueue) Offer(items ...int) []int
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 (*FastIntQueue) Partition ¶
func (queue *FastIntQueue) Partition(p func(int) bool) (*FastIntQueue, *FastIntQueue)
Partition returns two new FastIntQueues 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 (*FastIntQueue) Pop ¶
func (queue *FastIntQueue) Pop(n int) []int
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 (*FastIntQueue) Pop1 ¶
func (queue *FastIntQueue) Pop1() (int, 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 (*FastIntQueue) Push ¶
func (queue *FastIntQueue) Push(items ...int) *FastIntQueue
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 (*FastIntQueue) Reallocate ¶
func (queue *FastIntQueue) Reallocate(capacity int, overwrite bool) *FastIntQueue
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 (*FastIntQueue) Send ¶
func (queue *FastIntQueue) Send() <-chan int
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed. The channel will be closed when all the elements have been sent.
func (*FastIntQueue) Size ¶
func (queue *FastIntQueue) Size() int
Size gets the number of elements currently in this queue. This is an alias for Len.
func (*FastIntQueue) Sort ¶
func (queue *FastIntQueue) 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 NewFastIntSortedQueue).
func (*FastIntQueue) Space ¶
func (queue *FastIntQueue) Space() int
Space returns the space available in the queue.
func (*FastIntQueue) StableSort ¶
func (queue *FastIntQueue) 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 NewFastIntSortedQueue).
func (*FastIntQueue) Swap ¶
func (queue *FastIntQueue) Swap(i, j int)
Swap swaps the elements with indexes i and j. The queue must not be empty.
func (*FastIntQueue) ToInterfaceSlice ¶
func (queue *FastIntQueue) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the queue as a slice of arbitrary type. The queue is not altered.
func (*FastIntQueue) ToSlice ¶
func (queue *FastIntQueue) ToSlice() []int
ToSlice returns the elements of the queue as a slice. The queue is not altered.
type FastIntSequence ¶ added in v3.9.0
type FastIntSequence interface { FastIntCollection // 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) }
FastIntSequence defines an interface for sequence methods on int.
type FastIntSet ¶
type FastIntSet struct {
// contains filtered or unexported fields
}
FastIntSet is the primary type that represents a set.
func BuildFastIntSetFromChan ¶
func BuildFastIntSetFromChan(source <-chan int) *FastIntSet
BuildFastIntSetFromChan constructs a new FastIntSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertFastIntSet ¶
func ConvertFastIntSet(values ...interface{}) (*FastIntSet, bool)
ConvertFastIntSet 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 NewFastIntSet ¶
func NewFastIntSet(values ...int) *FastIntSet
NewFastIntSet creates and returns a reference to an empty set.
func (*FastIntSet) Cardinality ¶
func (set *FastIntSet) Cardinality() int
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*FastIntSet) Clear ¶
func (set *FastIntSet) Clear()
Clear the entire set. Aterwards, it will be an empty set.
func (*FastIntSet) Clone ¶
func (set *FastIntSet) Clone() *FastIntSet
Clone returns a shallow copy of the set. It does not clone the underlying elements.
func (*FastIntSet) Contains ¶
func (set *FastIntSet) Contains(i int) bool
Contains determines whether a given item is already in the set, returning true if so.
func (*FastIntSet) ContainsAll ¶
func (set *FastIntSet) ContainsAll(i ...int) bool
ContainsAll determines whether the given items are all in the set, returning true if so.
func (*FastIntSet) CountBy ¶
func (set *FastIntSet) CountBy(p func(int) bool) (result int)
CountBy gives the number elements of FastIntSet that return true for the predicate p.
func (*FastIntSet) Difference ¶
func (set *FastIntSet) Difference(other *FastIntSet) *FastIntSet
Difference returns a new set with items in the current set but not in the other set
func (*FastIntSet) Equals ¶
func (set *FastIntSet) Equals(other *FastIntSet) bool
Equals determines whether two sets are equal to each other, returning true if so. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal.
func (*FastIntSet) Exists ¶
func (set *FastIntSet) Exists(p func(int) bool) bool
Exists applies a predicate p to every element in the set. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (*FastIntSet) Filter ¶
func (set *FastIntSet) Filter(p func(int) bool) *FastIntSet
Filter returns a new FastIntSet whose elements return true for the predicate p.
The original set is not modified
func (*FastIntSet) Find ¶
func (set *FastIntSet) Find(p func(int) bool) (int, bool)
Find returns the first int that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.
func (*FastIntSet) FlatMap ¶
func (set *FastIntSet) FlatMap(f func(int) []int) *FastIntSet
FlatMap returns a new FastIntSet 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 (*FastIntSet) FlatMapToInt64 ¶
func (set *FastIntSet) FlatMapToInt64(f func(int) []int64) []int64
FlatMapToInt64 returns a new []int64 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 (*FastIntSet) FlatMapToString ¶
func (set *FastIntSet) FlatMapToString(f func(int) []string) []string
FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the set. 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 (*FastIntSet) Fold ¶ added in v3.9.0
Fold aggregates all the values in the set using a supplied function, starting from some initial value.
func (*FastIntSet) Forall ¶
func (set *FastIntSet) Forall(p func(int) bool) bool
Forall applies a predicate function p to every element in the set. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (*FastIntSet) Foreach ¶
func (set *FastIntSet) Foreach(f func(int))
Foreach iterates over the set and executes the function f against each element. The function can safely alter the values via side-effects.
func (*FastIntSet) Intersect ¶
func (set *FastIntSet) Intersect(other *FastIntSet) *FastIntSet
Intersect returns a new set with items that exist only in both sets.
func (*FastIntSet) IsEmpty ¶
func (set *FastIntSet) IsEmpty() bool
IsEmpty returns true if the set is empty.
func (*FastIntSet) IsSequence ¶
func (set *FastIntSet) IsSequence() bool
IsSequence returns true for lists and queues.
func (*FastIntSet) IsSet ¶
func (set *FastIntSet) IsSet() bool
IsSet returns false for lists or queues.
func (*FastIntSet) IsSubset ¶
func (set *FastIntSet) IsSubset(other *FastIntSet) bool
IsSubset determines whether every item in the other set is in this set, returning true if so.
func (*FastIntSet) IsSuperset ¶
func (set *FastIntSet) IsSuperset(other *FastIntSet) bool
IsSuperset determines whether every item of this set is in the other set, returning true if so.
func (*FastIntSet) Map ¶
func (set *FastIntSet) Map(f func(int) int) *FastIntSet
Map returns a new FastIntSet 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 (*FastIntSet) MapToInt64 ¶
func (set *FastIntSet) MapToInt64(f func(int) int64) []int64
MapToInt64 returns a new []int64 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 (*FastIntSet) MapToString ¶
func (set *FastIntSet) MapToString(f func(int) string) []string
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set. 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 (*FastIntSet) MarshalJSON ¶
func (set *FastIntSet) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this set type.
func (*FastIntSet) Max ¶
func (set *FastIntSet) Max() (result int)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (*FastIntSet) MaxBy ¶
func (set *FastIntSet) MaxBy(less func(int, int) bool) int
MaxBy returns an element of FastIntSet 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 (*FastIntSet) Min ¶
func (set *FastIntSet) Min() int
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (*FastIntSet) MinBy ¶
func (set *FastIntSet) MinBy(less func(int, int) bool) int
MinBy returns an element of FastIntSet 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 (*FastIntSet) MkString ¶
func (set *FastIntSet) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*FastIntSet) MkString3 ¶
func (set *FastIntSet) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*FastIntSet) NonEmpty ¶
func (set *FastIntSet) NonEmpty() bool
NonEmpty returns true if the set is not empty.
func (*FastIntSet) Partition ¶
func (set *FastIntSet) Partition(p func(int) bool) (*FastIntSet, *FastIntSet)
Partition returns two new FastIntSets whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list.
The original set is not modified
func (*FastIntSet) Send ¶
func (set *FastIntSet) Send() <-chan int
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed
func (*FastIntSet) Size ¶
func (set *FastIntSet) Size() int
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (*FastIntSet) String ¶
func (set *FastIntSet) String() string
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (*FastIntSet) StringList ¶
func (set *FastIntSet) StringList() []string
StringSet gets a list of strings that depicts all the elements.
func (*FastIntSet) StringMap ¶
func (set *FastIntSet) StringMap() map[string]bool
StringMap renders the set as a map of strings. The value of each item in the set becomes stringified as a key in the resulting map.
func (*FastIntSet) Sum ¶
func (set *FastIntSet) Sum() int
Sum returns the sum of all the elements in the set.
func (*FastIntSet) SymmetricDifference ¶
func (set *FastIntSet) SymmetricDifference(other *FastIntSet) *FastIntSet
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (*FastIntSet) ToInterfaceSlice ¶
func (set *FastIntSet) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.
func (*FastIntSet) ToSet ¶
func (set *FastIntSet) ToSet() *FastIntSet
ToSet returns the set; this is an identity operation in this case.
func (*FastIntSet) ToSlice ¶
func (set *FastIntSet) ToSlice() []int
ToSlice returns the elements of the current set as a slice.
func (*FastIntSet) Union ¶
func (set *FastIntSet) Union(other *FastIntSet) *FastIntSet
Union returns a new set with all items in both sets.
func (*FastIntSet) UnmarshalJSON ¶
func (set *FastIntSet) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this set type.
type FastIntSizer ¶
type FastIntSizer interface { // IsEmpty tests whether FastIntCollection is empty. IsEmpty() bool // NonEmpty tests whether FastIntCollection is empty. NonEmpty() bool // Size returns the number of items in the collection - an alias of Len(). Size() int }
FastIntSizer defines an interface for sizing methods on int collections.
type FastStringAppleMap ¶
type FastStringAppleMap struct {
// contains filtered or unexported fields
}
FastStringAppleMap is the primary type that represents a thread-safe map
func NewFastStringAppleMap ¶
func NewFastStringAppleMap(kv ...FastStringAppleTuple) *FastStringAppleMap
NewFastStringAppleMap creates and returns a reference to a map, optionally containing some items.
func NewFastStringAppleMap1 ¶
func NewFastStringAppleMap1(k string, v Apple) *FastStringAppleMap
NewFastStringAppleMap1 creates and returns a reference to a map containing one item.
func (*FastStringAppleMap) Clear ¶
func (mm *FastStringAppleMap) Clear()
Clear clears the entire map.
func (*FastStringAppleMap) Clone ¶
func (mm *FastStringAppleMap) Clone() *FastStringAppleMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (*FastStringAppleMap) ContainsAllKeys ¶
func (mm *FastStringAppleMap) ContainsAllKeys(kk ...string) bool
ContainsAllKeys determines if the given items are all in the map.
func (*FastStringAppleMap) ContainsKey ¶
func (mm *FastStringAppleMap) ContainsKey(k string) bool
ContainsKey determines if a given item is already in the map.
func (*FastStringAppleMap) DropWhere ¶
func (mm *FastStringAppleMap) DropWhere(fn func(string, Apple) bool) FastStringAppleTuples
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 (*FastStringAppleMap) Exists ¶
func (mm *FastStringAppleMap) Exists(p func(string, Apple) 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 (*FastStringAppleMap) Filter ¶
func (mm *FastStringAppleMap) Filter(p func(string, Apple) bool) *FastStringAppleMap
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 (*FastStringAppleMap) Find ¶
func (mm *FastStringAppleMap) Find(p func(string, Apple) bool) (FastStringAppleTuple, bool)
Find returns the first Apple that returns true for the predicate p. False is returned if none match. The original map is not modified.
func (*FastStringAppleMap) FlatMap ¶
func (mm *FastStringAppleMap) FlatMap(f func(string, Apple) []FastStringAppleTuple) *FastStringAppleMap
FlatMap returns a new FastAppleMap 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 (*FastStringAppleMap) Forall ¶
func (mm *FastStringAppleMap) Forall(p func(string, Apple) 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 (*FastStringAppleMap) Foreach ¶
func (mm *FastStringAppleMap) Foreach(f func(string, Apple))
Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.
func (*FastStringAppleMap) Get ¶
func (mm *FastStringAppleMap) Get(k string) (Apple, bool)
Get returns one of the items in the map, if present.
func (*FastStringAppleMap) GobDecode ¶
func (mm *FastStringAppleMap) GobDecode(b []byte) error
GobDecode implements 'gob' decoding for this map type. You must register Apple with the 'gob' package before this method is used.
func (*FastStringAppleMap) GobEncode ¶
func (mm *FastStringAppleMap) GobEncode() ([]byte, error)
GobEncode implements 'gob' encoding for this map type. You must register Apple with the 'gob' package before this method is used.
func (*FastStringAppleMap) IsEmpty ¶
func (mm *FastStringAppleMap) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (*FastStringAppleMap) Keys ¶
func (mm *FastStringAppleMap) Keys() []string
Keys returns the keys of the current map as a slice.
func (*FastStringAppleMap) Map ¶
func (mm *FastStringAppleMap) Map(f func(string, Apple) (string, Apple)) *FastStringAppleMap
Map returns a new FastAppleMap 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 (*FastStringAppleMap) NonEmpty ¶
func (mm *FastStringAppleMap) NonEmpty() bool
NonEmpty returns true if the map is not empty.
func (*FastStringAppleMap) OrderedSlice ¶ added in v3.6.0
func (mm *FastStringAppleMap) OrderedSlice(keys []string) FastStringAppleTuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (*FastStringAppleMap) Partition ¶
func (mm *FastStringAppleMap) Partition(p func(string, Apple) bool) (matching *FastStringAppleMap, others *FastStringAppleMap)
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 (*FastStringAppleMap) Pop ¶
func (mm *FastStringAppleMap) Pop(k string) (Apple, bool)
Pop removes a single item from the map, returning the value present prior to removal. The boolean result is true only if the key had been present.
func (*FastStringAppleMap) Put ¶
func (mm *FastStringAppleMap) Put(k string, v Apple) bool
Put adds an item to the current map, replacing any prior value.
func (*FastStringAppleMap) Remove ¶
func (mm *FastStringAppleMap) Remove(k string)
Remove a single item from the map.
func (*FastStringAppleMap) Size ¶
func (mm *FastStringAppleMap) Size() int
Size returns how many items are currently in the map. This is a synonym for Len.
func (*FastStringAppleMap) ToSlice ¶
func (mm *FastStringAppleMap) ToSlice() FastStringAppleTuples
ToSlice returns the key/value pairs as a slice
func (*FastStringAppleMap) Values ¶
func (mm *FastStringAppleMap) Values() []Apple
Values returns the values of the current map as a slice.
type FastStringAppleTuple ¶
FastStringAppleTuple represents a key/value pair.
type FastStringAppleTuples ¶
type FastStringAppleTuples []FastStringAppleTuple
FastStringAppleTuples can be used as a builder for unmodifiable maps.
func FastStringAppleZip ¶
func FastStringAppleZip(keys ...string) FastStringAppleTuples
FastStringAppleZip 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 NewFastStringAppleMap constructor function.
func (FastStringAppleTuples) Append1 ¶
func (ts FastStringAppleTuples) Append1(k string, v Apple) FastStringAppleTuples
Append1 adds one item.
func (FastStringAppleTuples) Append2 ¶
func (ts FastStringAppleTuples) Append2(k1 string, v1 Apple, k2 string, v2 Apple) FastStringAppleTuples
Append2 adds two items.
func (FastStringAppleTuples) Append3 ¶
func (ts FastStringAppleTuples) Append3(k1 string, v1 Apple, k2 string, v2 Apple, k3 string, v3 Apple) FastStringAppleTuples
Append3 adds three items.
func (FastStringAppleTuples) ToMap ¶ added in v3.6.0
func (ts FastStringAppleTuples) ToMap() *FastStringAppleMap
ToMap converts the tuples to a map.
func (FastStringAppleTuples) Values ¶
func (ts FastStringAppleTuples) Values(values ...Apple) FastStringAppleTuples
Values sets the values in a tuple slice. Use this with FastStringAppleZip.
type FastStringList ¶ added in v3.5.4
type FastStringList struct {
// contains filtered or unexported fields
}
FastStringList contains a slice of type string. It encapsulates the slice and provides methods to access or mutate it.
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 BuildFastStringListFromChan ¶ added in v3.5.4
func BuildFastStringListFromChan(source <-chan string) *FastStringList
BuildFastStringListFromChan constructs a new FastStringList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertFastStringList ¶ added in v3.5.4
func ConvertFastStringList(values ...interface{}) (*FastStringList, bool)
ConvertFastStringList 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 MakeFastStringList ¶ added in v3.5.4
func MakeFastStringList(length, capacity int) *FastStringList
MakeFastStringList makes an empty list with both length and capacity initialised.
func NewFastStringList ¶ added in v3.5.4
func NewFastStringList(values ...string) *FastStringList
NewFastStringList constructs a new list containing the supplied values, if any.
func (*FastStringList) Add ¶ added in v3.5.4
func (list *FastStringList) Add(more ...string)
Add adds items to the current list. This is a synonym for Append.
func (*FastStringList) Append ¶ added in v3.5.4
func (list *FastStringList) Append(more ...string) *FastStringList
Append adds items to the current list. If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned.
func (*FastStringList) Clear ¶ added in v3.5.4
func (list *FastStringList) Clear()
Clear the entire collection.
func (*FastStringList) Clone ¶ added in v3.5.4
func (list *FastStringList) Clone() *FastStringList
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (*FastStringList) Contains ¶ added in v3.5.4
func (list *FastStringList) Contains(v string) bool
Contains determines whether a given item is already in the list, returning true if so.
func (*FastStringList) ContainsAll ¶ added in v3.5.4
func (list *FastStringList) 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 (*FastStringList) CountBy ¶ added in v3.5.4
func (list *FastStringList) CountBy(p func(string) bool) (result int)
CountBy gives the number elements of FastStringList that return true for the predicate p.
func (*FastStringList) DistinctBy ¶ added in v3.5.4
func (list *FastStringList) DistinctBy(equal func(string, string) bool) *FastStringList
DistinctBy returns a new FastStringList whose elements are unique, where equality is defined by the equal function.
func (*FastStringList) DoDeleteAt ¶ added in v3.5.4
func (list *FastStringList) DoDeleteAt(index, n int) *FastStringList
DoDeleteAt modifies a FastStringList by deleting n elements from a given index.
The list is modified and the modified list is returned. Panics if the index is out of range or n is large enough to take the index out of range.
func (*FastStringList) DoDeleteFirst ¶ added in v3.5.4
func (list *FastStringList) DoDeleteFirst(n int) *FastStringList
DoDeleteFirst modifies a FastStringList by deleting n elements from the start of the list.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if n is large enough to take the index out of range.
func (*FastStringList) DoDeleteLast ¶ added in v3.5.4
func (list *FastStringList) DoDeleteLast(n int) *FastStringList
DoDeleteLast modifies a FastStringList by deleting n elements from the end of the list.
The list is modified and the modified list is returned. Panics if n is large enough to take the index out of range.
func (*FastStringList) DoInsertAt ¶ added in v3.5.4
func (list *FastStringList) DoInsertAt(index int, more ...string) *FastStringList
DoInsertAt modifies a FastStringList by inserting elements at a given index. This is a generalised version of Append.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if the index is out of range.
func (*FastStringList) DoKeepWhere ¶ added in v3.5.4
func (list *FastStringList) DoKeepWhere(p func(string) bool) *FastStringList
DoKeepWhere modifies a FastStringList by retaining only those elements that match the predicate p. This is very similar to Filter but alters the list in place.
The list is modified and the modified list is returned.
func (*FastStringList) DoReverse ¶ added in v3.5.4
func (list *FastStringList) DoReverse() *FastStringList
DoReverse alters a FastStringList 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 (*FastStringList) DoShuffle ¶ added in v3.5.4
func (list *FastStringList) DoShuffle() *FastStringList
DoShuffle returns a shuffled FastStringList, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (*FastStringList) Drop ¶ added in v3.5.4
func (list *FastStringList) Drop(n int) *FastStringList
Drop returns a slice of FastStringList 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 (*FastStringList) DropLast ¶ added in v3.5.4
func (list *FastStringList) DropLast(n int) *FastStringList
DropLast returns a slice of FastStringList 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 (*FastStringList) DropWhile ¶ added in v3.5.4
func (list *FastStringList) DropWhile(p func(string) bool) *FastStringList
DropWhile returns a new FastStringList 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 (*FastStringList) Equals ¶ added in v3.5.4
func (list *FastStringList) Equals(other *FastStringList) bool
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal. Nil lists are considered to be empty.
func (*FastStringList) Exists ¶ added in v3.5.4
func (list *FastStringList) Exists(p func(string) bool) bool
Exists verifies that one or more elements of FastStringList return true for the predicate p.
func (*FastStringList) Filter ¶ added in v3.5.4
func (list *FastStringList) Filter(p func(string) bool) *FastStringList
Filter returns a new FastStringList whose elements return true for predicate p.
The original list is not modified. See also DoKeepWhere (which does modify the original list).
func (*FastStringList) Find ¶ added in v3.5.4
func (list *FastStringList) 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 (*FastStringList) FlatMap ¶ added in v3.5.4
func (list *FastStringList) FlatMap(f func(string) []string) *FastStringList
FlatMap returns a new FastStringList 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 (*FastStringList) FlatMapToInt ¶ added in v3.5.4
func (list *FastStringList) 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 (*FastStringList) Fold ¶ added in v3.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (*FastStringList) Forall ¶ added in v3.5.4
func (list *FastStringList) Forall(p func(string) bool) bool
Forall verifies that all elements of FastStringList return true for the predicate p.
func (*FastStringList) Foreach ¶ added in v3.5.4
func (list *FastStringList) Foreach(f func(string))
Foreach iterates over FastStringList and executes function f against each element. The function can safely alter the values via side-effects.
func (*FastStringList) Get ¶ added in v3.5.4
func (list *FastStringList) Get(i int) string
Get gets the specified element in the list. Panics if the index is out of range or the list is nil.
func (*FastStringList) Head ¶ added in v3.5.4
func (list *FastStringList) 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 (*FastStringList) HeadOption ¶ added in v3.5.4
func (list *FastStringList) HeadOption() (string, bool)
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (*FastStringList) IndexWhere ¶ added in v3.5.4
func (list *FastStringList) IndexWhere(p func(string) bool) int
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (*FastStringList) IndexWhere2 ¶ added in v3.5.4
func (list *FastStringList) 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 (*FastStringList) Init ¶ added in v3.5.4
func (list *FastStringList) Init() *FastStringList
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 (*FastStringList) IsEmpty ¶ added in v3.5.4
func (list *FastStringList) IsEmpty() bool
IsEmpty tests whether FastStringList is empty.
func (*FastStringList) IsSequence ¶ added in v3.5.4
func (list *FastStringList) IsSequence() bool
IsSequence returns true for lists and queues.
func (*FastStringList) IsSet ¶ added in v3.5.4
func (list *FastStringList) IsSet() bool
IsSet returns false for lists or queues.
func (*FastStringList) Last ¶ added in v3.5.4
func (list *FastStringList) 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 (*FastStringList) LastIndexWhere ¶ added in v3.5.4
func (list *FastStringList) LastIndexWhere(p func(string) bool) int
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (*FastStringList) LastIndexWhere2 ¶ added in v3.5.4
func (list *FastStringList) 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 (*FastStringList) LastOption ¶ added in v3.5.4
func (list *FastStringList) LastOption() (string, bool)
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (*FastStringList) Len ¶ added in v3.5.4
func (list *FastStringList) 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 (*FastStringList) Map ¶ added in v3.5.4
func (list *FastStringList) Map(f func(string) string) *FastStringList
Map returns a new FastStringList 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 (*FastStringList) MapToInt ¶ added in v3.5.4
func (list *FastStringList) 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 (FastStringList) MarshalJSON ¶ added in v3.5.4
func (list FastStringList) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this list type.
func (*FastStringList) Max ¶ added in v3.5.4
func (list *FastStringList) Max() (result string)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (*FastStringList) MaxBy ¶ added in v3.5.4
func (list *FastStringList) MaxBy(less func(string, string) bool) string
MaxBy returns an element of FastStringList 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 (*FastStringList) Min ¶ added in v3.5.4
func (list *FastStringList) Min() string
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (*FastStringList) MinBy ¶ added in v3.5.4
func (list *FastStringList) MinBy(less func(string, string) bool) string
MinBy returns an element of FastStringList 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 (*FastStringList) MkString ¶ added in v3.5.4
func (list *FastStringList) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*FastStringList) MkString3 ¶ added in v3.5.4
func (list *FastStringList) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*FastStringList) NonEmpty ¶ added in v3.5.4
func (list *FastStringList) NonEmpty() bool
NonEmpty tests whether FastStringList is empty.
func (*FastStringList) Partition ¶ added in v3.5.4
func (list *FastStringList) Partition(p func(string) bool) (*FastStringList, *FastStringList)
Partition returns two new FastStringLists 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 (*FastStringList) Reverse ¶ added in v3.5.4
func (list *FastStringList) Reverse() *FastStringList
Reverse returns a copy of FastStringList with all elements in the reverse order.
The original list is not modified.
func (*FastStringList) Send ¶ added in v3.5.4
func (list *FastStringList) 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 (*FastStringList) Shuffle ¶ added in v3.5.4
func (list *FastStringList) Shuffle() *FastStringList
Shuffle returns a shuffled copy of FastStringList, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (*FastStringList) Size ¶ added in v3.5.4
func (list *FastStringList) Size() int
Size returns the number of items in the list - an alias of Len().
func (*FastStringList) SortBy ¶ added in v3.5.4
func (list *FastStringList) SortBy(less func(i, j string) bool) *FastStringList
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (*FastStringList) Sorted ¶ added in v3.5.4
func (list *FastStringList) Sorted() *FastStringList
Sorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (*FastStringList) StableSortBy ¶ added in v3.5.4
func (list *FastStringList) StableSortBy(less func(i, j string) bool) *FastStringList
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 (*FastStringList) StableSorted ¶ added in v3.5.4
func (list *FastStringList) StableSorted() *FastStringList
StableSorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (*FastStringList) String ¶ added in v3.5.4
func (list *FastStringList) String() string
String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.
func (*FastStringList) StringList ¶ added in v3.5.4
func (list *FastStringList) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (*FastStringList) Swap ¶ added in v3.5.4
func (list *FastStringList) 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 (*FastStringList) Tail ¶ added in v3.5.4
func (list *FastStringList) Tail() *FastStringList
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 (*FastStringList) Take ¶ added in v3.5.4
func (list *FastStringList) Take(n int) *FastStringList
Take returns a slice of FastStringList 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 (*FastStringList) TakeLast ¶ added in v3.5.4
func (list *FastStringList) TakeLast(n int) *FastStringList
TakeLast returns a slice of FastStringList 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 (*FastStringList) TakeWhile ¶ added in v3.5.4
func (list *FastStringList) TakeWhile(p func(string) bool) *FastStringList
TakeWhile returns a new FastStringList 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 (*FastStringList) ToInterfaceSlice ¶ added in v3.5.4
func (list *FastStringList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (*FastStringList) ToList ¶ added in v3.5.4
func (list *FastStringList) ToList() *FastStringList
ToList returns the elements of the list as a list, which is an identity operation in this case.
func (*FastStringList) ToSlice ¶ added in v3.5.4
func (list *FastStringList) ToSlice() []string
ToSlice returns the elements of the current list as a slice.
func (*FastStringList) UnmarshalJSON ¶ added in v3.5.4
func (list *FastStringList) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this list type.
type ImmutableAppleCollection ¶
type ImmutableAppleCollection interface { ImmutableAppleSizer // 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() []Apple // ToInterfaceSlice returns a shallow copy as a slice of arbitrary type. ToInterfaceSlice() []interface{} // Exists verifies that one or more elements of ImmutableAppleCollection return true for the predicate p. Exists(p func(Apple) bool) bool // Forall verifies that all elements of ImmutableAppleCollection return true for the predicate p. Forall(p func(Apple) bool) bool // Foreach iterates over ImmutableAppleCollection and executes the function f against each element. Foreach(f func(Apple)) // Find returns the first Apple that returns true for the predicate p. // False is returned if none match. Find(p func(Apple) bool) (Apple, bool) // MapToString returns a new []string by transforming every element with function f. // The resulting slice is the same size as the collection. The collection is not modified. MapToString(f func(Apple) string) []string // FlatMapString returns a new []string by transforming every element with function f // that returns zero or more items in a slice. The resulting slice may have a different size to the // collection. The collection is not modified. FlatMapToString(f func(Apple) []string) []string // Send returns a channel that will send all the elements in order. Can be used with the plumbing code, for example. // A goroutine is created to send the elements; this only terminates when all the elements have been consumed Send() <-chan Apple // CountBy gives the number elements of ImmutableAppleCollection that return true for the predicate p. CountBy(p func(Apple) bool) int // MinBy returns an element of ImmutableAppleCollection 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(Apple, Apple) bool) Apple // MaxBy returns an element of ImmutableAppleCollection 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(Apple, Apple) bool) Apple // Fold aggregates all the values in the collection using a supplied function, starting from some initial value. Fold(initial Apple, fn func(Apple, Apple) Apple) Apple }
ImmutableAppleCollection defines an interface for common collection methods on Apple.
type ImmutableAppleList ¶
type ImmutableAppleList struct {
// contains filtered or unexported fields
}
ImmutableAppleList contains a slice of type Apple. It is designed to be immutable - ideal for race-free reference lists etc. It encapsulates the slice and provides methods to access it. Importantly, *none of its methods ever mutate a list*; they merely return new lists where required.
List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq
func BuildImmutableAppleListFromChan ¶
func BuildImmutableAppleListFromChan(source <-chan Apple) *ImmutableAppleList
BuildImmutableAppleListFromChan constructs a new ImmutableAppleList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertImmutableAppleList ¶
func ConvertImmutableAppleList(values ...interface{}) (*ImmutableAppleList, bool)
ConvertImmutableAppleList 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 NewImmutableAppleList ¶
func NewImmutableAppleList(values ...Apple) *ImmutableAppleList
NewImmutableAppleList constructs a new list containing the supplied values, if any.
func (*ImmutableAppleList) Append ¶
func (list *ImmutableAppleList) Append(more ...Apple) *ImmutableAppleList
Append returns a new list with all original items and all in `more`; they retain their order. The original list is not altered.
func (*ImmutableAppleList) Clone ¶
func (list *ImmutableAppleList) Clone() *ImmutableAppleList
Clone returns the same list, which is immutable.
func (*ImmutableAppleList) CountBy ¶
func (list *ImmutableAppleList) CountBy(p func(Apple) bool) (result int)
CountBy gives the number elements of ImmutableAppleList that return true for the predicate p.
func (*ImmutableAppleList) DistinctBy ¶
func (list *ImmutableAppleList) DistinctBy(equal func(Apple, Apple) bool) *ImmutableAppleList
DistinctBy returns a new ImmutableAppleList whose elements are unique, where equality is defined by the equal function.
func (*ImmutableAppleList) Drop ¶
func (list *ImmutableAppleList) Drop(n int) *ImmutableAppleList
Drop returns a slice of ImmutableAppleList without the leading n elements of the source list. If n is greater than or equal to the size of the list, an empty list is returned.
func (*ImmutableAppleList) DropLast ¶
func (list *ImmutableAppleList) DropLast(n int) *ImmutableAppleList
DropLast returns a slice of ImmutableAppleList without the trailing n elements of the source list. If n is greater than or equal to the size of the list, an empty list is returned.
func (*ImmutableAppleList) DropWhile ¶
func (list *ImmutableAppleList) DropWhile(p func(Apple) bool) *ImmutableAppleList
DropWhile returns a new ImmutableAppleList containing the trailing elements of the source list. Whilst the predicate p returns true, elements are excluded from the result. Once predicate p returns false, all remaining elements are added.
func (*ImmutableAppleList) Exists ¶
func (list *ImmutableAppleList) Exists(p func(Apple) bool) bool
Exists verifies that one or more elements of ImmutableAppleList return true for the predicate p.
func (*ImmutableAppleList) Filter ¶
func (list *ImmutableAppleList) Filter(p func(Apple) bool) *ImmutableAppleList
Filter returns a new ImmutableAppleList whose elements return true for predicate p.
func (*ImmutableAppleList) Find ¶
func (list *ImmutableAppleList) Find(p func(Apple) bool) (Apple, bool)
Find returns the first Apple that returns true for predicate p. False is returned if none match.
func (*ImmutableAppleList) FlatMap ¶
func (list *ImmutableAppleList) FlatMap(f func(Apple) []Apple) *ImmutableAppleList
FlatMap returns a new ImmutableAppleList by transforming every element with function f that returns zero or more items in a slice. The resulting list may have a different size to the original list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableAppleList) FlatMapToString ¶ added in v3.5.0
func (list *ImmutableAppleList) FlatMapToString(f func(Apple) []string) []string
FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableAppleList) Fold ¶ added in v3.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (*ImmutableAppleList) Forall ¶
func (list *ImmutableAppleList) Forall(p func(Apple) bool) bool
Forall verifies that all elements of ImmutableAppleList return true for the predicate p.
func (*ImmutableAppleList) Foreach ¶
func (list *ImmutableAppleList) Foreach(f func(Apple))
Foreach iterates over ImmutableAppleList and executes function f against each element. The function receives copies that do not alter the list elements when they are changed.
func (*ImmutableAppleList) Get ¶
func (list *ImmutableAppleList) Get(i int) Apple
Get gets the specified element in the list. Panics if the index is out of range or the list is nil.
func (*ImmutableAppleList) GobDecode ¶
func (list *ImmutableAppleList) GobDecode(b []byte) error
GobDecode implements 'gob' decoding for this list type. You must register Apple with the 'gob' package before this method is used.
func (ImmutableAppleList) GobEncode ¶
func (list ImmutableAppleList) GobEncode() ([]byte, error)
GobEncode implements 'gob' encoding for this list type. You must register Apple with the 'gob' package before this method is used.
func (*ImmutableAppleList) Head ¶
func (list *ImmutableAppleList) Head() Apple
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 (*ImmutableAppleList) HeadOption ¶
func (list *ImmutableAppleList) HeadOption() (Apple, bool)
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (*ImmutableAppleList) IndexWhere ¶
func (list *ImmutableAppleList) IndexWhere(p func(Apple) bool) int
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (*ImmutableAppleList) IndexWhere2 ¶
func (list *ImmutableAppleList) IndexWhere2(p func(Apple) 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 (*ImmutableAppleList) Init ¶
func (list *ImmutableAppleList) Init() *ImmutableAppleList
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 (*ImmutableAppleList) IsEmpty ¶
func (list *ImmutableAppleList) IsEmpty() bool
IsEmpty tests whether ImmutableAppleList is empty.
func (*ImmutableAppleList) IsSequence ¶
func (list *ImmutableAppleList) IsSequence() bool
IsSequence returns true for lists and queues.
func (*ImmutableAppleList) IsSet ¶
func (list *ImmutableAppleList) IsSet() bool
IsSet returns false for lists or queues.
func (*ImmutableAppleList) Last ¶
func (list *ImmutableAppleList) Last() Apple
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 (*ImmutableAppleList) LastIndexWhere ¶
func (list *ImmutableAppleList) LastIndexWhere(p func(Apple) bool) int
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (*ImmutableAppleList) LastIndexWhere2 ¶
func (list *ImmutableAppleList) LastIndexWhere2(p func(Apple) 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 (*ImmutableAppleList) LastOption ¶
func (list *ImmutableAppleList) LastOption() (Apple, bool)
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (*ImmutableAppleList) Len ¶
func (list *ImmutableAppleList) Len() int
Len returns the number of items in the list - an alias of Size().
func (*ImmutableAppleList) Map ¶
func (list *ImmutableAppleList) Map(f func(Apple) Apple) *ImmutableAppleList
Map returns a new ImmutableAppleList by transforming every element with function f. The resulting list is the same size as the original list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableAppleList) MapToString ¶ added in v3.5.0
func (list *ImmutableAppleList) MapToString(f func(Apple) string) []string
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableAppleList) MaxBy ¶
func (list *ImmutableAppleList) MaxBy(less func(Apple, Apple) bool) Apple
MaxBy returns an element of ImmutableAppleList 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 (*ImmutableAppleList) MinBy ¶
func (list *ImmutableAppleList) MinBy(less func(Apple, Apple) bool) Apple
MinBy returns an element of ImmutableAppleList 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 (*ImmutableAppleList) NonEmpty ¶
func (list *ImmutableAppleList) NonEmpty() bool
NonEmpty tests whether ImmutableAppleList is empty.
func (*ImmutableAppleList) Partition ¶
func (list *ImmutableAppleList) Partition(p func(Apple) bool) (*ImmutableAppleList, *ImmutableAppleList)
Partition returns two new AppleLists whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list.
func (*ImmutableAppleList) Reverse ¶
func (list *ImmutableAppleList) Reverse() *ImmutableAppleList
Reverse returns a copy of ImmutableAppleList with all elements in the reverse order.
func (*ImmutableAppleList) Send ¶
func (list *ImmutableAppleList) Send() <-chan Apple
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 (*ImmutableAppleList) Shuffle ¶
func (list *ImmutableAppleList) Shuffle() *ImmutableAppleList
Shuffle returns a shuffled copy of ImmutableAppleList, using a version of the Fisher-Yates shuffle.
func (*ImmutableAppleList) Size ¶
func (list *ImmutableAppleList) Size() int
Size returns the number of items in the list - an alias of Len().
func (*ImmutableAppleList) SortBy ¶
func (list *ImmutableAppleList) SortBy(less func(i, j Apple) bool) *ImmutableAppleList
SortBy returns a new list in which the elements are sorted by a specified ordering.
func (*ImmutableAppleList) StableSortBy ¶
func (list *ImmutableAppleList) StableSortBy(less func(i, j Apple) bool) *ImmutableAppleList
StableSortBy returns a new list in which the elements are sorted by a specified ordering. The algorithm keeps the original order of equal elements.
func (*ImmutableAppleList) Tail ¶
func (list *ImmutableAppleList) Tail() *ImmutableAppleList
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 (*ImmutableAppleList) Take ¶
func (list *ImmutableAppleList) Take(n int) *ImmutableAppleList
Take returns a slice of ImmutableAppleList 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 (*ImmutableAppleList) TakeLast ¶
func (list *ImmutableAppleList) TakeLast(n int) *ImmutableAppleList
TakeLast returns a slice of ImmutableAppleList containing the trailing n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.
func (*ImmutableAppleList) TakeWhile ¶
func (list *ImmutableAppleList) TakeWhile(p func(Apple) bool) *ImmutableAppleList
TakeWhile returns a new ImmutableAppleList containing the leading elements of the source list. Whilst the predicate p returns true, elements are added to the result. Once predicate p returns false, all remaining elements are excluded.
func (*ImmutableAppleList) ToInterfaceSlice ¶
func (list *ImmutableAppleList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (*ImmutableAppleList) ToList ¶
func (list *ImmutableAppleList) ToList() *ImmutableAppleList
ToList returns the elements of the list as a list, which is an identity operation in this case.
func (*ImmutableAppleList) ToSlice ¶
func (list *ImmutableAppleList) ToSlice() []Apple
ToSlice returns the elements of the current list as a slice.
type ImmutableAppleSequence ¶ added in v3.9.0
type ImmutableAppleSequence interface { ImmutableAppleCollection // Head gets the first element in the sequence. Head plus Tail include the whole sequence. Head is the opposite of Last. Head() Apple // HeadOption gets the first element in the sequence, if possible. HeadOption() (Apple, bool) // Last gets the last element in the sequence. Init plus Last include the whole sequence. Last is the opposite of Head. Last() Apple // LastOption gets the last element in the sequence, if possible. LastOption() (Apple, bool) }
ImmutableAppleSequence defines an interface for sequence methods on Apple.
type ImmutableAppleSet ¶
type ImmutableAppleSet struct {
// contains filtered or unexported fields
}
ImmutableAppleSet is the primary type that represents a set.
func BuildImmutableAppleSetFromChan ¶
func BuildImmutableAppleSetFromChan(source <-chan Apple) *ImmutableAppleSet
BuildImmutableAppleSetFromChan constructs a new ImmutableAppleSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertImmutableAppleSet ¶
func ConvertImmutableAppleSet(values ...interface{}) (*ImmutableAppleSet, bool)
ConvertImmutableAppleSet 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 NewImmutableAppleSet ¶
func NewImmutableAppleSet(values ...Apple) *ImmutableAppleSet
NewImmutableAppleSet creates and returns a reference to an empty set.
func (*ImmutableAppleSet) Add ¶
func (set *ImmutableAppleSet) Add(more ...Apple) *ImmutableAppleSet
Add returns a new set with all original items and all in `more`. The original set is not altered.
func (*ImmutableAppleSet) Cardinality ¶
func (set *ImmutableAppleSet) Cardinality() int
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*ImmutableAppleSet) Clone ¶
func (set *ImmutableAppleSet) Clone() *ImmutableAppleSet
Clone returns the same set, which is immutable.
func (*ImmutableAppleSet) Contains ¶
func (set *ImmutableAppleSet) Contains(i Apple) bool
Contains determines whether a given item is already in the set, returning true if so.
func (*ImmutableAppleSet) ContainsAll ¶
func (set *ImmutableAppleSet) ContainsAll(i ...Apple) bool
ContainsAll determines whether a given item is already in the set, returning true if so.
func (*ImmutableAppleSet) CountBy ¶
func (set *ImmutableAppleSet) CountBy(p func(Apple) bool) (result int)
CountBy gives the number elements of ImmutableAppleSet that return true for the predicate p.
func (*ImmutableAppleSet) Difference ¶
func (set *ImmutableAppleSet) Difference(other *ImmutableAppleSet) *ImmutableAppleSet
Difference returns a new set with items in the current set but not in the other set
func (*ImmutableAppleSet) Equals ¶
func (set *ImmutableAppleSet) Equals(other *ImmutableAppleSet) bool
Equals determines whether two sets are equal to each other, returning true if so. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal.
func (*ImmutableAppleSet) Exists ¶
func (set *ImmutableAppleSet) Exists(p func(Apple) bool) bool
Exists applies a predicate p to every element in the set. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (*ImmutableAppleSet) Filter ¶
func (set *ImmutableAppleSet) Filter(p func(Apple) bool) *ImmutableAppleSet
Filter returns a new ImmutableAppleSet whose elements return true for the predicate p.
func (*ImmutableAppleSet) Find ¶
func (set *ImmutableAppleSet) Find(p func(Apple) bool) (Apple, bool)
Find returns the first Apple that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.
func (*ImmutableAppleSet) FlatMap ¶
func (set *ImmutableAppleSet) FlatMap(f func(Apple) []Apple) *ImmutableAppleSet
FlatMap returns a new ImmutableAppleSet by transforming every element with a function f that returns zero or more items in a slice. The resulting set may have a different size to the original set.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableAppleSet) FlatMapToString ¶ added in v3.5.0
func (set *ImmutableAppleSet) FlatMapToString(f func(Apple) []string) []string
FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the set.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableAppleSet) Fold ¶ added in v3.9.0
Fold aggregates all the values in the set using a supplied function, starting from some initial value.
func (*ImmutableAppleSet) Forall ¶
func (set *ImmutableAppleSet) Forall(p func(Apple) bool) bool
Forall applies a predicate function p to every element in the set. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (*ImmutableAppleSet) Foreach ¶
func (set *ImmutableAppleSet) Foreach(f func(Apple))
Foreach iterates over AppleSet and executes the function f against each element.
func (*ImmutableAppleSet) GobDecode ¶
func (set *ImmutableAppleSet) GobDecode(b []byte) error
GobDecode implements 'gob' decoding for this set type. You must register Apple with the 'gob' package before this method is used.
func (ImmutableAppleSet) GobEncode ¶
func (set ImmutableAppleSet) GobEncode() ([]byte, error)
GobEncode implements 'gob' encoding for this list type. You must register Apple with the 'gob' package before this method is used.
func (*ImmutableAppleSet) Intersect ¶
func (set *ImmutableAppleSet) Intersect(other *ImmutableAppleSet) *ImmutableAppleSet
Intersect returns a new set with items that exist only in both sets.
func (*ImmutableAppleSet) IsEmpty ¶
func (set *ImmutableAppleSet) IsEmpty() bool
IsEmpty returns true if the set is empty.
func (*ImmutableAppleSet) IsSequence ¶
func (set *ImmutableAppleSet) IsSequence() bool
IsSequence returns true for lists and queues.
func (*ImmutableAppleSet) IsSet ¶
func (set *ImmutableAppleSet) IsSet() bool
IsSet returns false for lists or queues.
func (*ImmutableAppleSet) IsSubset ¶
func (set *ImmutableAppleSet) IsSubset(other *ImmutableAppleSet) bool
IsSubset determines whether every item in the other set is in this set, returning true if so.
func (*ImmutableAppleSet) IsSuperset ¶
func (set *ImmutableAppleSet) IsSuperset(other *ImmutableAppleSet) bool
IsSuperset determines whether every item of this set is in the other set, returning true if so.
func (*ImmutableAppleSet) Map ¶
func (set *ImmutableAppleSet) Map(f func(Apple) Apple) *ImmutableAppleSet
Map returns a new ImmutableAppleSet by transforming every element with a function f.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableAppleSet) MapToString ¶ added in v3.5.0
func (set *ImmutableAppleSet) MapToString(f func(Apple) string) []string
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableAppleSet) MaxBy ¶
func (set *ImmutableAppleSet) MaxBy(less func(Apple, Apple) bool) Apple
MaxBy returns an element of ImmutableAppleSet 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 (*ImmutableAppleSet) MinBy ¶
func (set *ImmutableAppleSet) MinBy(less func(Apple, Apple) bool) Apple
MinBy returns an element of ImmutableAppleSet 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 (*ImmutableAppleSet) NonEmpty ¶
func (set *ImmutableAppleSet) NonEmpty() bool
NonEmpty returns true if the set is not empty.
func (*ImmutableAppleSet) Partition ¶
func (set *ImmutableAppleSet) Partition(p func(Apple) bool) (*ImmutableAppleSet, *ImmutableAppleSet)
Partition returns two new AppleSets whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list.
func (*ImmutableAppleSet) Remove ¶
func (set *ImmutableAppleSet) Remove(i Apple) *ImmutableAppleSet
Remove removes a single item from the set. A new set is returned that has all the elements except the removed one.
func (*ImmutableAppleSet) Send ¶
func (set *ImmutableAppleSet) Send() <-chan Apple
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 (*ImmutableAppleSet) Size ¶
func (set *ImmutableAppleSet) Size() int
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (*ImmutableAppleSet) SymmetricDifference ¶
func (set *ImmutableAppleSet) SymmetricDifference(other *ImmutableAppleSet) *ImmutableAppleSet
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (*ImmutableAppleSet) ToInterfaceSlice ¶
func (set *ImmutableAppleSet) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.
func (*ImmutableAppleSet) ToSet ¶
func (set *ImmutableAppleSet) ToSet() *ImmutableAppleSet
ToSet returns the set; this is an identity operation in this case.
func (*ImmutableAppleSet) ToSlice ¶
func (set *ImmutableAppleSet) ToSlice() []Apple
ToSlice returns the elements of the current set as a slice.
func (*ImmutableAppleSet) Union ¶
func (set *ImmutableAppleSet) Union(other *ImmutableAppleSet) *ImmutableAppleSet
Union returns a new set with all items in both sets.
type ImmutableAppleSizer ¶
type ImmutableAppleSizer interface { // IsEmpty tests whether ImmutableAppleCollection is empty. IsEmpty() bool // NonEmpty tests whether ImmutableAppleCollection is empty. NonEmpty() bool // Size returns the number of items in the list - an alias of Len(). Size() int }
ImmutableAppleSizer defines an interface for sizing methods on Apple collections.
type ImmutableIntCollection ¶
type ImmutableIntCollection interface { ImmutableIntSizer ImmutableIntMkStringer // 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 ImmutableIntCollection return true for the predicate p. Exists(p func(int) bool) bool // Forall verifies that all elements of ImmutableIntCollection return true for the predicate p. Forall(p func(int) bool) bool // Foreach iterates over ImmutableIntCollection and executes the function f against each element. Foreach(f func(int)) // Find returns the first int that returns true for the predicate p. // False is returned if none match. Find(p func(int) bool) (int, bool) // MapToString returns a new []string by transforming every element with function f. // The resulting slice is the same size as the collection. The collection is not modified. MapToString(f func(int) string) []string // MapToInt64 returns a new []int64 by transforming every element with function f. // The resulting slice is the same size as the collection. The collection is not modified. MapToInt64(f func(int) int64) []int64 // FlatMapString returns a new []string by transforming every element with function f // that returns zero or more items in a slice. The resulting slice may have a different size to the // collection. The collection is not modified. FlatMapToString(f func(int) []string) []string // FlatMapInt64 returns a new []int64 by transforming every element with function f // that returns zero or more items in a slice. The resulting slice may have a different size to the // collection. The collection is not modified. FlatMapToInt64(f func(int) []int64) []int64 // 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 ImmutableIntCollection 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 ImmutableIntCollection 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 ImmutableIntCollection 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 }
ImmutableIntCollection defines an interface for common collection methods on int.
type ImmutableIntIntMap ¶
type ImmutableIntIntMap struct {
// contains filtered or unexported fields
}
ImmutableIntIntMap is the primary type that represents a thread-safe map
func NewImmutableIntIntMap ¶
func NewImmutableIntIntMap(kv ...ImmutableIntIntTuple) *ImmutableIntIntMap
NewImmutableIntIntMap creates and returns a reference to a map, optionally containing some items.
func NewImmutableIntIntMap1 ¶
func NewImmutableIntIntMap1(k int, v int) *ImmutableIntIntMap
NewImmutableIntIntMap1 creates and returns a reference to a map containing one item.
func (*ImmutableIntIntMap) Clone ¶
func (mm *ImmutableIntIntMap) Clone() *ImmutableIntIntMap
Clone returns the same map, which is immutable.
func (*ImmutableIntIntMap) ContainsAllKeys ¶
func (mm *ImmutableIntIntMap) ContainsAllKeys(kk ...int) bool
ContainsAllKeys determines if the given items are all in the map.
func (*ImmutableIntIntMap) ContainsKey ¶
func (mm *ImmutableIntIntMap) ContainsKey(k int) bool
ContainsKey determines if a given item is already in the map.
func (*ImmutableIntIntMap) Equals ¶
func (mm *ImmutableIntIntMap) Equals(other *ImmutableIntIntMap) 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 (*ImmutableIntIntMap) Exists ¶
func (mm *ImmutableIntIntMap) Exists(p func(int, int) bool) bool
Exists applies the predicate p to every element in the map. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (*ImmutableIntIntMap) Filter ¶
func (mm *ImmutableIntIntMap) Filter(p func(int, int) bool) *ImmutableIntIntMap
Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.
func (*ImmutableIntIntMap) Find ¶
func (mm *ImmutableIntIntMap) Find(p func(int, int) bool) (ImmutableIntIntTuple, bool)
Find returns the first int that returns true for the predicate p. False is returned if none match.
func (*ImmutableIntIntMap) FlatMap ¶
func (mm *ImmutableIntIntMap) FlatMap(f func(int, int) []ImmutableIntIntTuple) *ImmutableIntIntMap
FlatMap returns a new ImmutableIntMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntIntMap) Forall ¶
func (mm *ImmutableIntIntMap) Forall(f func(int, int) bool) bool
Forall applies the predicate p to every element in the map. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (*ImmutableIntIntMap) Foreach ¶
func (mm *ImmutableIntIntMap) Foreach(f func(int, int))
Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.
func (*ImmutableIntIntMap) Get ¶
func (mm *ImmutableIntIntMap) Get(k int) (int, bool)
Get returns one of the items in the map, if present.
func (*ImmutableIntIntMap) IsEmpty ¶
func (mm *ImmutableIntIntMap) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (*ImmutableIntIntMap) Keys ¶
func (mm *ImmutableIntIntMap) Keys() []int
Keys returns the keys of the current map as a slice.
func (*ImmutableIntIntMap) Map ¶
func (mm *ImmutableIntIntMap) Map(f func(int, int) (int, int)) *ImmutableIntIntMap
Map returns a new ImmutableIntMap by transforming every element with the function f.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntIntMap) MkString ¶
func (mm *ImmutableIntIntMap) MkString(sep string) string
MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.
func (*ImmutableIntIntMap) MkString4 ¶ added in v3.7.0
func (mm *ImmutableIntIntMap) MkString4(before, between, after, equals string) string
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (*ImmutableIntIntMap) NonEmpty ¶
func (mm *ImmutableIntIntMap) NonEmpty() bool
NonEmpty returns true if the map is not empty.
func (*ImmutableIntIntMap) OrderedSlice ¶ added in v3.6.0
func (mm *ImmutableIntIntMap) OrderedSlice(keys []int) ImmutableIntIntTuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (*ImmutableIntIntMap) Partition ¶
func (mm *ImmutableIntIntMap) Partition(p func(int, int) bool) (matching *ImmutableIntIntMap, others *ImmutableIntIntMap)
Partition applies the predicate p to every element in the map. It divides the map into two copied maps, the first containing all the elements for which the predicate returned true, and the second containing all the others.
func (*ImmutableIntIntMap) Put ¶ added in v3.3.0
func (mm *ImmutableIntIntMap) Put(k int, v int) *ImmutableIntIntMap
Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.
func (*ImmutableIntIntMap) Size ¶
func (mm *ImmutableIntIntMap) Size() int
Size returns how many items are currently in the map. This is a synonym for Len.
func (*ImmutableIntIntMap) String ¶
func (mm *ImmutableIntIntMap) String() string
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (*ImmutableIntIntMap) ToSlice ¶
func (mm *ImmutableIntIntMap) ToSlice() ImmutableIntIntTuples
ToSlice returns the key/value pairs as a slice
func (*ImmutableIntIntMap) Values ¶
func (mm *ImmutableIntIntMap) Values() []int
Values returns the values of the current map as a slice.
type ImmutableIntIntTuple ¶
ImmutableIntIntTuple represents a key/value pair.
func (ImmutableIntIntTuple) MarshalJSON ¶ added in v3.6.0
func (t ImmutableIntIntTuple) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding.Marshaler interface.
func (ImmutableIntIntTuple) UnmarshalJSON ¶ added in v3.6.0
func (t ImmutableIntIntTuple) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this tuple type.
type ImmutableIntIntTuples ¶
type ImmutableIntIntTuples []ImmutableIntIntTuple
ImmutableIntIntTuples can be used as a builder for unmodifiable maps.
func ImmutableIntIntZip ¶
func ImmutableIntIntZip(keys ...int) ImmutableIntIntTuples
ImmutableIntIntZip 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 NewImmutableIntIntMap constructor function.
func (ImmutableIntIntTuples) Append1 ¶
func (ts ImmutableIntIntTuples) Append1(k int, v int) ImmutableIntIntTuples
Append1 adds one item.
func (ImmutableIntIntTuples) Append2 ¶
func (ts ImmutableIntIntTuples) Append2(k1 int, v1 int, k2 int, v2 int) ImmutableIntIntTuples
Append2 adds two items.
func (ImmutableIntIntTuples) Append3 ¶
func (ts ImmutableIntIntTuples) Append3(k1 int, v1 int, k2 int, v2 int, k3 int, v3 int) ImmutableIntIntTuples
Append3 adds three items.
func (ImmutableIntIntTuples) MkString ¶ added in v3.6.0
func (ts ImmutableIntIntTuples) MkString(sep string) string
MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.
func (ImmutableIntIntTuples) MkString4 ¶ added in v3.7.0
func (ts ImmutableIntIntTuples) MkString4(before, between, after, equals string) string
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (ImmutableIntIntTuples) String ¶ added in v3.6.0
func (ts ImmutableIntIntTuples) String() string
func (ImmutableIntIntTuples) ToMap ¶ added in v3.6.0
func (ts ImmutableIntIntTuples) ToMap() *ImmutableIntIntMap
ToMap converts the tuples to a map.
func (ImmutableIntIntTuples) Values ¶
func (ts ImmutableIntIntTuples) Values(values ...int) ImmutableIntIntTuples
Values sets the values in a tuple slice. Use this with ImmutableIntIntZip.
type ImmutableIntList ¶
type ImmutableIntList struct {
// contains filtered or unexported fields
}
ImmutableIntList contains a slice of type int. It is designed to be immutable - ideal for race-free reference lists etc. It encapsulates the slice and provides methods to access it. Importantly, *none of its methods ever mutate a list*; they merely return new lists where required.
List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq
func BuildImmutableIntListFromChan ¶
func BuildImmutableIntListFromChan(source <-chan int) *ImmutableIntList
BuildImmutableIntListFromChan constructs a new ImmutableIntList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertImmutableIntList ¶
func ConvertImmutableIntList(values ...interface{}) (*ImmutableIntList, bool)
ConvertImmutableIntList 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 NewImmutableIntList ¶
func NewImmutableIntList(values ...int) *ImmutableIntList
NewImmutableIntList constructs a new list containing the supplied values, if any.
func (*ImmutableIntList) Append ¶
func (list *ImmutableIntList) Append(more ...int) *ImmutableIntList
Append returns a new list with all original items and all in `more`; they retain their order. The original list is not altered.
func (*ImmutableIntList) Clone ¶
func (list *ImmutableIntList) Clone() *ImmutableIntList
Clone returns the same list, which is immutable.
func (*ImmutableIntList) Contains ¶
func (list *ImmutableIntList) Contains(v int) bool
Contains determines whether a given item is already in the list, returning true if so.
func (*ImmutableIntList) ContainsAll ¶
func (list *ImmutableIntList) ContainsAll(i ...int) bool
ContainsAll determines whether the given items are all in the list, returning true if so. This is potentially a slow method and should only be used rarely.
func (*ImmutableIntList) CountBy ¶
func (list *ImmutableIntList) CountBy(p func(int) bool) (result int)
CountBy gives the number elements of ImmutableIntList that return true for the predicate p.
func (*ImmutableIntList) DistinctBy ¶
func (list *ImmutableIntList) DistinctBy(equal func(int, int) bool) *ImmutableIntList
DistinctBy returns a new ImmutableIntList whose elements are unique, where equality is defined by the equal function.
func (*ImmutableIntList) Drop ¶
func (list *ImmutableIntList) Drop(n int) *ImmutableIntList
Drop returns a slice of ImmutableIntList without the leading n elements of the source list. If n is greater than or equal to the size of the list, an empty list is returned.
func (*ImmutableIntList) DropLast ¶
func (list *ImmutableIntList) DropLast(n int) *ImmutableIntList
DropLast returns a slice of ImmutableIntList without the trailing n elements of the source list. If n is greater than or equal to the size of the list, an empty list is returned.
func (*ImmutableIntList) DropWhile ¶
func (list *ImmutableIntList) DropWhile(p func(int) bool) *ImmutableIntList
DropWhile returns a new ImmutableIntList containing the trailing elements of the source list. Whilst the predicate p returns true, elements are excluded from the result. Once predicate p returns false, all remaining elements are added.
func (*ImmutableIntList) Equals ¶
func (list *ImmutableIntList) Equals(other *ImmutableIntList) bool
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal. Nil lists are considered to be empty.
func (*ImmutableIntList) Exists ¶
func (list *ImmutableIntList) Exists(p func(int) bool) bool
Exists verifies that one or more elements of ImmutableIntList return true for the predicate p.
func (*ImmutableIntList) Filter ¶
func (list *ImmutableIntList) Filter(p func(int) bool) *ImmutableIntList
Filter returns a new ImmutableIntList whose elements return true for predicate p.
func (*ImmutableIntList) Find ¶
func (list *ImmutableIntList) Find(p func(int) bool) (int, bool)
Find returns the first int that returns true for predicate p. False is returned if none match.
func (*ImmutableIntList) FlatMap ¶
func (list *ImmutableIntList) FlatMap(f func(int) []int) *ImmutableIntList
FlatMap returns a new ImmutableIntList by transforming every element with function f that returns zero or more items in a slice. The resulting list may have a different size to the original list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntList) FlatMapToInt64 ¶ added in v3.5.0
func (list *ImmutableIntList) FlatMapToInt64(f func(int) []int64) []int64
FlatMapToInt64 returns a new []int64 by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntList) FlatMapToString ¶ added in v3.5.0
func (list *ImmutableIntList) FlatMapToString(f func(int) []string) []string
FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntList) Fold ¶ added in v3.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (*ImmutableIntList) Forall ¶
func (list *ImmutableIntList) Forall(p func(int) bool) bool
Forall verifies that all elements of ImmutableIntList return true for the predicate p.
func (*ImmutableIntList) Foreach ¶
func (list *ImmutableIntList) Foreach(f func(int))
Foreach iterates over ImmutableIntList and executes function f against each element. The function receives copies that do not alter the list elements when they are changed.
func (*ImmutableIntList) Get ¶
func (list *ImmutableIntList) Get(i int) int
Get gets the specified element in the list. Panics if the index is out of range or the list is nil.
func (*ImmutableIntList) Head ¶
func (list *ImmutableIntList) Head() int
Head gets the first element in the list. Head plus Tail include the whole list. Head is the opposite of Last. Panics if list is empty or nil.
func (*ImmutableIntList) HeadOption ¶
func (list *ImmutableIntList) HeadOption() (int, bool)
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (*ImmutableIntList) IndexWhere ¶
func (list *ImmutableIntList) IndexWhere(p func(int) bool) int
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (*ImmutableIntList) IndexWhere2 ¶
func (list *ImmutableIntList) IndexWhere2(p func(int) bool, from int) int
IndexWhere2 finds the index of the first element satisfying predicate p at or after some start index. If none exists, -1 is returned.
func (*ImmutableIntList) Init ¶
func (list *ImmutableIntList) Init() *ImmutableIntList
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 (*ImmutableIntList) IsEmpty ¶
func (list *ImmutableIntList) IsEmpty() bool
IsEmpty tests whether ImmutableIntList is empty.
func (*ImmutableIntList) IsSequence ¶
func (list *ImmutableIntList) IsSequence() bool
IsSequence returns true for lists and queues.
func (*ImmutableIntList) IsSet ¶
func (list *ImmutableIntList) IsSet() bool
IsSet returns false for lists or queues.
func (*ImmutableIntList) Last ¶
func (list *ImmutableIntList) Last() int
Last gets the last element in the list. Init plus Last include the whole list. Last is the opposite of Head. Panics if list is empty or nil.
func (*ImmutableIntList) LastIndexWhere ¶
func (list *ImmutableIntList) LastIndexWhere(p func(int) bool) int
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (*ImmutableIntList) LastIndexWhere2 ¶
func (list *ImmutableIntList) LastIndexWhere2(p func(int) bool, before int) int
LastIndexWhere2 finds the index of the last element satisfying predicate p at or before some start index. If none exists, -1 is returned.
func (*ImmutableIntList) LastOption ¶
func (list *ImmutableIntList) LastOption() (int, bool)
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (*ImmutableIntList) Len ¶
func (list *ImmutableIntList) Len() int
Len returns the number of items in the list - an alias of Size().
func (*ImmutableIntList) Map ¶
func (list *ImmutableIntList) Map(f func(int) int) *ImmutableIntList
Map returns a new ImmutableIntList by transforming every element with function f. The resulting list is the same size as the original list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntList) MapToInt64 ¶ added in v3.5.0
func (list *ImmutableIntList) MapToInt64(f func(int) int64) []int64
MapToInt64 returns a new []int64 by transforming every element with function f. The resulting slice is the same size as the list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntList) MapToString ¶ added in v3.5.0
func (list *ImmutableIntList) MapToString(f func(int) string) []string
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (ImmutableIntList) MarshalJSON ¶
func (list ImmutableIntList) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this list type.
func (*ImmutableIntList) Max ¶
func (list *ImmutableIntList) Max() (result int)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (*ImmutableIntList) MaxBy ¶
func (list *ImmutableIntList) MaxBy(less func(int, int) bool) int
MaxBy returns an element of ImmutableIntList 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 (*ImmutableIntList) Min ¶
func (list *ImmutableIntList) Min() int
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (*ImmutableIntList) MinBy ¶
func (list *ImmutableIntList) MinBy(less func(int, int) bool) int
MinBy returns an element of ImmutableIntList 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 (*ImmutableIntList) MkString ¶
func (list *ImmutableIntList) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*ImmutableIntList) MkString3 ¶
func (list *ImmutableIntList) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*ImmutableIntList) NonEmpty ¶
func (list *ImmutableIntList) NonEmpty() bool
NonEmpty tests whether ImmutableIntList is empty.
func (*ImmutableIntList) Partition ¶
func (list *ImmutableIntList) Partition(p func(int) bool) (*ImmutableIntList, *ImmutableIntList)
Partition returns two new intLists whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list.
func (*ImmutableIntList) Reverse ¶
func (list *ImmutableIntList) Reverse() *ImmutableIntList
Reverse returns a copy of ImmutableIntList with all elements in the reverse order.
func (*ImmutableIntList) Send ¶
func (list *ImmutableIntList) Send() <-chan int
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed. The channel will be closed when all the elements have been sent.
func (*ImmutableIntList) Shuffle ¶
func (list *ImmutableIntList) Shuffle() *ImmutableIntList
Shuffle returns a shuffled copy of ImmutableIntList, using a version of the Fisher-Yates shuffle.
func (*ImmutableIntList) Size ¶
func (list *ImmutableIntList) Size() int
Size returns the number of items in the list - an alias of Len().
func (*ImmutableIntList) SortBy ¶
func (list *ImmutableIntList) SortBy(less func(i, j int) bool) *ImmutableIntList
SortBy returns a new list in which the elements are sorted by a specified ordering.
func (*ImmutableIntList) Sorted ¶
func (list *ImmutableIntList) Sorted() *ImmutableIntList
Sorted returns a new list in which the elements are sorted by their natural ordering.
func (*ImmutableIntList) StableSortBy ¶
func (list *ImmutableIntList) StableSortBy(less func(i, j int) bool) *ImmutableIntList
StableSortBy returns a new list in which the elements are sorted by a specified ordering. The algorithm keeps the original order of equal elements.
func (*ImmutableIntList) StableSorted ¶
func (list *ImmutableIntList) StableSorted() *ImmutableIntList
StableSorted returns a new list in which the elements are sorted by their natural ordering.
func (*ImmutableIntList) String ¶
func (list *ImmutableIntList) String() string
String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.
func (*ImmutableIntList) StringList ¶
func (list *ImmutableIntList) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (*ImmutableIntList) Sum ¶
func (list *ImmutableIntList) Sum() int
Sum returns the sum of all the elements in the list.
func (*ImmutableIntList) Tail ¶
func (list *ImmutableIntList) Tail() *ImmutableIntList
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 (*ImmutableIntList) Take ¶
func (list *ImmutableIntList) Take(n int) *ImmutableIntList
Take returns a slice of ImmutableIntList 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 (*ImmutableIntList) TakeLast ¶
func (list *ImmutableIntList) TakeLast(n int) *ImmutableIntList
TakeLast returns a slice of ImmutableIntList containing the trailing n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.
func (*ImmutableIntList) TakeWhile ¶
func (list *ImmutableIntList) TakeWhile(p func(int) bool) *ImmutableIntList
TakeWhile returns a new ImmutableIntList containing the leading elements of the source list. Whilst the predicate p returns true, elements are added to the result. Once predicate p returns false, all remaining elements are excluded.
func (*ImmutableIntList) ToInterfaceSlice ¶
func (list *ImmutableIntList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (*ImmutableIntList) ToList ¶
func (list *ImmutableIntList) ToList() *ImmutableIntList
ToList returns the elements of the list as a list, which is an identity operation in this case.
func (*ImmutableIntList) ToSlice ¶
func (list *ImmutableIntList) ToSlice() []int
ToSlice returns the elements of the current list as a slice.
func (*ImmutableIntList) UnmarshalJSON ¶
func (list *ImmutableIntList) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this list type.
type ImmutableIntMkStringer ¶
type ImmutableIntMkStringer interface { // String implements the Stringer interface to render the list as a comma-separated string enclosed // in square brackets. String() string // MkString concatenates the values as a string using a supplied separator. No enclosing marks are added. MkString(sep string) string // MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied. MkString3(before, between, after string) string // implements json.Marshaler interface { MarshalJSON() ([]byte, error) // StringList gets a slice of strings that depicts all the elements. StringList() []string }
ImmutableIntMkStringer defines an interface for stringer methods on int collections.
type ImmutableIntSequence ¶ added in v3.9.0
type ImmutableIntSequence interface { ImmutableIntCollection // 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) }
ImmutableIntSequence defines an interface for sequence methods on int.
type ImmutableIntSet ¶
type ImmutableIntSet struct {
// contains filtered or unexported fields
}
ImmutableIntSet is the primary type that represents a set.
func BuildImmutableIntSetFromChan ¶
func BuildImmutableIntSetFromChan(source <-chan int) *ImmutableIntSet
BuildImmutableIntSetFromChan constructs a new ImmutableIntSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertImmutableIntSet ¶
func ConvertImmutableIntSet(values ...interface{}) (*ImmutableIntSet, bool)
ConvertImmutableIntSet 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 NewImmutableIntSet ¶
func NewImmutableIntSet(values ...int) *ImmutableIntSet
NewImmutableIntSet creates and returns a reference to an empty set.
func (*ImmutableIntSet) Add ¶
func (set *ImmutableIntSet) Add(more ...int) *ImmutableIntSet
Add returns a new set with all original items and all in `more`. The original set is not altered.
func (*ImmutableIntSet) Cardinality ¶
func (set *ImmutableIntSet) Cardinality() int
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*ImmutableIntSet) Clone ¶
func (set *ImmutableIntSet) Clone() *ImmutableIntSet
Clone returns the same set, which is immutable.
func (*ImmutableIntSet) Contains ¶
func (set *ImmutableIntSet) Contains(i int) bool
Contains determines whether a given item is already in the set, returning true if so.
func (*ImmutableIntSet) ContainsAll ¶
func (set *ImmutableIntSet) ContainsAll(i ...int) bool
ContainsAll determines whether a given item is already in the set, returning true if so.
func (*ImmutableIntSet) CountBy ¶
func (set *ImmutableIntSet) CountBy(p func(int) bool) (result int)
CountBy gives the number elements of ImmutableIntSet that return true for the predicate p.
func (*ImmutableIntSet) Difference ¶
func (set *ImmutableIntSet) Difference(other *ImmutableIntSet) *ImmutableIntSet
Difference returns a new set with items in the current set but not in the other set
func (*ImmutableIntSet) Equals ¶
func (set *ImmutableIntSet) Equals(other *ImmutableIntSet) bool
Equals determines whether two sets are equal to each other, returning true if so. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal.
func (*ImmutableIntSet) Exists ¶
func (set *ImmutableIntSet) Exists(p func(int) bool) bool
Exists applies a predicate p to every element in the set. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (*ImmutableIntSet) Filter ¶
func (set *ImmutableIntSet) Filter(p func(int) bool) *ImmutableIntSet
Filter returns a new ImmutableIntSet whose elements return true for the predicate p.
func (*ImmutableIntSet) Find ¶
func (set *ImmutableIntSet) Find(p func(int) bool) (int, bool)
Find returns the first int that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.
func (*ImmutableIntSet) FlatMap ¶
func (set *ImmutableIntSet) FlatMap(f func(int) []int) *ImmutableIntSet
FlatMap returns a new ImmutableIntSet by transforming every element with a function f that returns zero or more items in a slice. The resulting set may have a different size to the original set.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntSet) FlatMapToInt64 ¶ added in v3.5.0
func (set *ImmutableIntSet) FlatMapToInt64(f func(int) []int64) []int64
FlatMapToInt64 returns a new []int64 by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the set.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntSet) FlatMapToString ¶ added in v3.5.0
func (set *ImmutableIntSet) FlatMapToString(f func(int) []string) []string
FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the set.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntSet) Fold ¶ added in v3.9.0
Fold aggregates all the values in the set using a supplied function, starting from some initial value.
func (*ImmutableIntSet) Forall ¶
func (set *ImmutableIntSet) Forall(p func(int) bool) bool
Forall applies a predicate function p to every element in the set. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (*ImmutableIntSet) Foreach ¶
func (set *ImmutableIntSet) Foreach(f func(int))
Foreach iterates over intSet and executes the function f against each element.
func (*ImmutableIntSet) Intersect ¶
func (set *ImmutableIntSet) Intersect(other *ImmutableIntSet) *ImmutableIntSet
Intersect returns a new set with items that exist only in both sets.
func (*ImmutableIntSet) IsEmpty ¶
func (set *ImmutableIntSet) IsEmpty() bool
IsEmpty returns true if the set is empty.
func (*ImmutableIntSet) IsSequence ¶
func (set *ImmutableIntSet) IsSequence() bool
IsSequence returns true for lists and queues.
func (*ImmutableIntSet) IsSet ¶
func (set *ImmutableIntSet) IsSet() bool
IsSet returns false for lists or queues.
func (*ImmutableIntSet) IsSubset ¶
func (set *ImmutableIntSet) IsSubset(other *ImmutableIntSet) bool
IsSubset determines whether every item in the other set is in this set, returning true if so.
func (*ImmutableIntSet) IsSuperset ¶
func (set *ImmutableIntSet) IsSuperset(other *ImmutableIntSet) bool
IsSuperset determines whether every item of this set is in the other set, returning true if so.
func (*ImmutableIntSet) Map ¶
func (set *ImmutableIntSet) Map(f func(int) int) *ImmutableIntSet
Map returns a new ImmutableIntSet by transforming every element with a function f.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntSet) MapToInt64 ¶ added in v3.5.0
func (set *ImmutableIntSet) MapToInt64(f func(int) int64) []int64
MapToInt64 returns a new []int64 by transforming every element with function f. The resulting slice is the same size as the set.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntSet) MapToString ¶ added in v3.5.0
func (set *ImmutableIntSet) MapToString(f func(int) string) []string
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableIntSet) MarshalJSON ¶
func (set *ImmutableIntSet) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this set type.
func (*ImmutableIntSet) Max ¶
func (set *ImmutableIntSet) Max() (result int)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (*ImmutableIntSet) MaxBy ¶
func (set *ImmutableIntSet) MaxBy(less func(int, int) bool) int
MaxBy returns an element of ImmutableIntSet 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 (*ImmutableIntSet) Min ¶
func (set *ImmutableIntSet) Min() int
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (*ImmutableIntSet) MinBy ¶
func (set *ImmutableIntSet) MinBy(less func(int, int) bool) int
MinBy returns an element of ImmutableIntSet 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 (*ImmutableIntSet) MkString ¶
func (set *ImmutableIntSet) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*ImmutableIntSet) MkString3 ¶
func (set *ImmutableIntSet) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*ImmutableIntSet) NonEmpty ¶
func (set *ImmutableIntSet) NonEmpty() bool
NonEmpty returns true if the set is not empty.
func (*ImmutableIntSet) Partition ¶
func (set *ImmutableIntSet) Partition(p func(int) bool) (*ImmutableIntSet, *ImmutableIntSet)
Partition returns two new intSets whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list.
func (*ImmutableIntSet) Remove ¶
func (set *ImmutableIntSet) Remove(i int) *ImmutableIntSet
Remove removes a single item from the set. A new set is returned that has all the elements except the removed one.
func (*ImmutableIntSet) Send ¶
func (set *ImmutableIntSet) Send() <-chan int
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed
func (*ImmutableIntSet) Size ¶
func (set *ImmutableIntSet) Size() int
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (*ImmutableIntSet) String ¶
func (set *ImmutableIntSet) String() string
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (*ImmutableIntSet) StringList ¶
func (set *ImmutableIntSet) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (*ImmutableIntSet) StringMap ¶
func (set *ImmutableIntSet) StringMap() map[string]bool
StringMap renders the set as a map of strings. The value of each item in the set becomes stringified as a key in the resulting map.
func (*ImmutableIntSet) Sum ¶
func (set *ImmutableIntSet) Sum() int
Sum returns the sum of all the elements in the set.
func (*ImmutableIntSet) SymmetricDifference ¶
func (set *ImmutableIntSet) SymmetricDifference(other *ImmutableIntSet) *ImmutableIntSet
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (*ImmutableIntSet) ToInterfaceSlice ¶
func (set *ImmutableIntSet) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.
func (*ImmutableIntSet) ToSet ¶
func (set *ImmutableIntSet) ToSet() *ImmutableIntSet
ToSet returns the set; this is an identity operation in this case.
func (*ImmutableIntSet) ToSlice ¶
func (set *ImmutableIntSet) ToSlice() []int
ToSlice returns the elements of the current set as a slice.
func (*ImmutableIntSet) Union ¶
func (set *ImmutableIntSet) Union(other *ImmutableIntSet) *ImmutableIntSet
Union returns a new set with all items in both sets.
func (*ImmutableIntSet) UnmarshalJSON ¶
func (set *ImmutableIntSet) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this set type.
type ImmutableIntSizer ¶
type ImmutableIntSizer interface { // IsEmpty tests whether ImmutableIntCollection is empty. IsEmpty() bool // NonEmpty tests whether ImmutableIntCollection is empty. NonEmpty() bool // Size returns the number of items in the list - an alias of Len(). Size() int }
ImmutableIntSizer defines an interface for sizing methods on int collections.
type ImmutableStringAppleMap ¶
type ImmutableStringAppleMap struct {
// contains filtered or unexported fields
}
ImmutableStringAppleMap is the primary type that represents a thread-safe map
func NewImmutableStringAppleMap ¶
func NewImmutableStringAppleMap(kv ...ImmutableStringAppleTuple) *ImmutableStringAppleMap
NewImmutableStringAppleMap creates and returns a reference to a map, optionally containing some items.
func NewImmutableStringAppleMap1 ¶
func NewImmutableStringAppleMap1(k string, v Apple) *ImmutableStringAppleMap
NewImmutableStringAppleMap1 creates and returns a reference to a map containing one item.
func (*ImmutableStringAppleMap) Clone ¶
func (mm *ImmutableStringAppleMap) Clone() *ImmutableStringAppleMap
Clone returns the same map, which is immutable.
func (*ImmutableStringAppleMap) ContainsAllKeys ¶
func (mm *ImmutableStringAppleMap) ContainsAllKeys(kk ...string) bool
ContainsAllKeys determines if the given items are all in the map.
func (*ImmutableStringAppleMap) ContainsKey ¶
func (mm *ImmutableStringAppleMap) ContainsKey(k string) bool
ContainsKey determines if a given item is already in the map.
func (*ImmutableStringAppleMap) Exists ¶
func (mm *ImmutableStringAppleMap) Exists(p func(string, Apple) 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 (*ImmutableStringAppleMap) Filter ¶
func (mm *ImmutableStringAppleMap) Filter(p func(string, Apple) bool) *ImmutableStringAppleMap
Filter applies the predicate p to every element in the map and returns a copied map containing only the elements for which the predicate returned true.
func (*ImmutableStringAppleMap) Find ¶
func (mm *ImmutableStringAppleMap) Find(p func(string, Apple) bool) (ImmutableStringAppleTuple, bool)
Find returns the first Apple that returns true for the predicate p. False is returned if none match.
func (*ImmutableStringAppleMap) FlatMap ¶
func (mm *ImmutableStringAppleMap) FlatMap(f func(string, Apple) []ImmutableStringAppleTuple) *ImmutableStringAppleMap
FlatMap returns a new ImmutableAppleMap by transforming every element with the function f that returns zero or more items in a slice. The resulting map may have a different size to the original map.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableStringAppleMap) Forall ¶
func (mm *ImmutableStringAppleMap) Forall(f func(string, Apple) 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 (*ImmutableStringAppleMap) Foreach ¶
func (mm *ImmutableStringAppleMap) Foreach(f func(string, Apple))
Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.
func (*ImmutableStringAppleMap) Get ¶
func (mm *ImmutableStringAppleMap) Get(k string) (Apple, bool)
Get returns one of the items in the map, if present.
func (*ImmutableStringAppleMap) GobDecode ¶
func (mm *ImmutableStringAppleMap) GobDecode(b []byte) error
GobDecode implements 'gob' decoding for this map type. You must register Apple with the 'gob' package before this method is used.
func (*ImmutableStringAppleMap) GobEncode ¶
func (mm *ImmutableStringAppleMap) GobEncode() ([]byte, error)
GobEncode implements 'gob' encoding for this map type. You must register Apple with the 'gob' package before this method is used.
func (*ImmutableStringAppleMap) IsEmpty ¶
func (mm *ImmutableStringAppleMap) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (*ImmutableStringAppleMap) Keys ¶
func (mm *ImmutableStringAppleMap) Keys() []string
Keys returns the keys of the current map as a slice.
func (*ImmutableStringAppleMap) Map ¶
func (mm *ImmutableStringAppleMap) Map(f func(string, Apple) (string, Apple)) *ImmutableStringAppleMap
Map returns a new ImmutableAppleMap by transforming every element with the function f.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableStringAppleMap) NonEmpty ¶
func (mm *ImmutableStringAppleMap) NonEmpty() bool
NonEmpty returns true if the map is not empty.
func (*ImmutableStringAppleMap) OrderedSlice ¶ added in v3.6.0
func (mm *ImmutableStringAppleMap) OrderedSlice(keys []string) ImmutableStringAppleTuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (*ImmutableStringAppleMap) Partition ¶
func (mm *ImmutableStringAppleMap) Partition(p func(string, Apple) bool) (matching *ImmutableStringAppleMap, others *ImmutableStringAppleMap)
Partition applies the predicate p to every element in the map. It divides the map into two copied maps, the first containing all the elements for which the predicate returned true, and the second containing all the others.
func (*ImmutableStringAppleMap) Put ¶ added in v3.3.0
func (mm *ImmutableStringAppleMap) Put(k string, v Apple) *ImmutableStringAppleMap
Put adds an item to a clone of the map, replacing any prior value and returning the cloned map.
func (*ImmutableStringAppleMap) Size ¶
func (mm *ImmutableStringAppleMap) Size() int
Size returns how many items are currently in the map. This is a synonym for Len.
func (*ImmutableStringAppleMap) ToSlice ¶
func (mm *ImmutableStringAppleMap) ToSlice() ImmutableStringAppleTuples
ToSlice returns the key/value pairs as a slice
func (*ImmutableStringAppleMap) Values ¶
func (mm *ImmutableStringAppleMap) Values() []Apple
Values returns the values of the current map as a slice.
type ImmutableStringAppleTuple ¶
ImmutableStringAppleTuple represents a key/value pair.
type ImmutableStringAppleTuples ¶
type ImmutableStringAppleTuples []ImmutableStringAppleTuple
ImmutableStringAppleTuples can be used as a builder for unmodifiable maps.
func ImmutableStringAppleZip ¶
func ImmutableStringAppleZip(keys ...string) ImmutableStringAppleTuples
ImmutableStringAppleZip 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 NewImmutableStringAppleMap constructor function.
func (ImmutableStringAppleTuples) Append1 ¶
func (ts ImmutableStringAppleTuples) Append1(k string, v Apple) ImmutableStringAppleTuples
Append1 adds one item.
func (ImmutableStringAppleTuples) Append2 ¶
func (ts ImmutableStringAppleTuples) Append2(k1 string, v1 Apple, k2 string, v2 Apple) ImmutableStringAppleTuples
Append2 adds two items.
func (ImmutableStringAppleTuples) Append3 ¶
func (ts ImmutableStringAppleTuples) Append3(k1 string, v1 Apple, k2 string, v2 Apple, k3 string, v3 Apple) ImmutableStringAppleTuples
Append3 adds three items.
func (ImmutableStringAppleTuples) ToMap ¶ added in v3.6.0
func (ts ImmutableStringAppleTuples) ToMap() *ImmutableStringAppleMap
ToMap converts the tuples to a map.
func (ImmutableStringAppleTuples) Values ¶
func (ts ImmutableStringAppleTuples) Values(values ...Apple) ImmutableStringAppleTuples
Values sets the values in a tuple slice. Use this with ImmutableStringAppleZip.
type ImmutableStringList ¶ added in v3.5.4
type ImmutableStringList struct {
// contains filtered or unexported fields
}
ImmutableStringList contains a slice of type string. It is designed to be immutable - ideal for race-free reference lists etc. It encapsulates the slice and provides methods to access it. Importantly, *none of its methods ever mutate a list*; they merely return new lists where required.
List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq
func BuildImmutableStringListFromChan ¶ added in v3.5.4
func BuildImmutableStringListFromChan(source <-chan string) *ImmutableStringList
BuildImmutableStringListFromChan constructs a new ImmutableStringList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertImmutableStringList ¶ added in v3.5.4
func ConvertImmutableStringList(values ...interface{}) (*ImmutableStringList, bool)
ConvertImmutableStringList 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 NewImmutableStringList ¶ added in v3.5.4
func NewImmutableStringList(values ...string) *ImmutableStringList
NewImmutableStringList constructs a new list containing the supplied values, if any.
func (*ImmutableStringList) Append ¶ added in v3.5.4
func (list *ImmutableStringList) Append(more ...string) *ImmutableStringList
Append returns a new list with all original items and all in `more`; they retain their order. The original list is not altered.
func (*ImmutableStringList) Clone ¶ added in v3.5.4
func (list *ImmutableStringList) Clone() *ImmutableStringList
Clone returns the same list, which is immutable.
func (*ImmutableStringList) Contains ¶ added in v3.5.4
func (list *ImmutableStringList) Contains(v string) bool
Contains determines whether a given item is already in the list, returning true if so.
func (*ImmutableStringList) ContainsAll ¶ added in v3.5.4
func (list *ImmutableStringList) 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 (*ImmutableStringList) CountBy ¶ added in v3.5.4
func (list *ImmutableStringList) CountBy(p func(string) bool) (result int)
CountBy gives the number elements of ImmutableStringList that return true for the predicate p.
func (*ImmutableStringList) DistinctBy ¶ added in v3.5.4
func (list *ImmutableStringList) DistinctBy(equal func(string, string) bool) *ImmutableStringList
DistinctBy returns a new ImmutableStringList whose elements are unique, where equality is defined by the equal function.
func (*ImmutableStringList) Drop ¶ added in v3.5.4
func (list *ImmutableStringList) Drop(n int) *ImmutableStringList
Drop returns a slice of ImmutableStringList without the leading n elements of the source list. If n is greater than or equal to the size of the list, an empty list is returned.
func (*ImmutableStringList) DropLast ¶ added in v3.5.4
func (list *ImmutableStringList) DropLast(n int) *ImmutableStringList
DropLast returns a slice of ImmutableStringList without the trailing n elements of the source list. If n is greater than or equal to the size of the list, an empty list is returned.
func (*ImmutableStringList) DropWhile ¶ added in v3.5.4
func (list *ImmutableStringList) DropWhile(p func(string) bool) *ImmutableStringList
DropWhile returns a new ImmutableStringList containing the trailing elements of the source list. Whilst the predicate p returns true, elements are excluded from the result. Once predicate p returns false, all remaining elements are added.
func (*ImmutableStringList) Equals ¶ added in v3.5.4
func (list *ImmutableStringList) Equals(other *ImmutableStringList) bool
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal. Nil lists are considered to be empty.
func (*ImmutableStringList) Exists ¶ added in v3.5.4
func (list *ImmutableStringList) Exists(p func(string) bool) bool
Exists verifies that one or more elements of ImmutableStringList return true for the predicate p.
func (*ImmutableStringList) Filter ¶ added in v3.5.4
func (list *ImmutableStringList) Filter(p func(string) bool) *ImmutableStringList
Filter returns a new ImmutableStringList whose elements return true for predicate p.
func (*ImmutableStringList) Find ¶ added in v3.5.4
func (list *ImmutableStringList) 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 (*ImmutableStringList) FlatMap ¶ added in v3.5.4
func (list *ImmutableStringList) FlatMap(f func(string) []string) *ImmutableStringList
FlatMap returns a new ImmutableStringList by transforming every element with function f that returns zero or more items in a slice. The resulting list may have a different size to the original list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableStringList) FlatMapToInt ¶ added in v3.5.4
func (list *ImmutableStringList) FlatMapToInt(f func(string) []int) []int
FlatMapToInt returns a new []int by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableStringList) Fold ¶ added in v3.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (*ImmutableStringList) Forall ¶ added in v3.5.4
func (list *ImmutableStringList) Forall(p func(string) bool) bool
Forall verifies that all elements of ImmutableStringList return true for the predicate p.
func (*ImmutableStringList) Foreach ¶ added in v3.5.4
func (list *ImmutableStringList) Foreach(f func(string))
Foreach iterates over ImmutableStringList and executes function f against each element. The function receives copies that do not alter the list elements when they are changed.
func (*ImmutableStringList) Get ¶ added in v3.5.4
func (list *ImmutableStringList) Get(i int) string
Get gets the specified element in the list. Panics if the index is out of range or the list is nil.
func (*ImmutableStringList) Head ¶ added in v3.5.4
func (list *ImmutableStringList) 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 (*ImmutableStringList) HeadOption ¶ added in v3.5.4
func (list *ImmutableStringList) HeadOption() (string, bool)
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (*ImmutableStringList) IndexWhere ¶ added in v3.5.4
func (list *ImmutableStringList) IndexWhere(p func(string) bool) int
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (*ImmutableStringList) IndexWhere2 ¶ added in v3.5.4
func (list *ImmutableStringList) 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 (*ImmutableStringList) Init ¶ added in v3.5.4
func (list *ImmutableStringList) Init() *ImmutableStringList
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 (*ImmutableStringList) IsEmpty ¶ added in v3.5.4
func (list *ImmutableStringList) IsEmpty() bool
IsEmpty tests whether ImmutableStringList is empty.
func (*ImmutableStringList) IsSequence ¶ added in v3.5.4
func (list *ImmutableStringList) IsSequence() bool
IsSequence returns true for lists and queues.
func (*ImmutableStringList) IsSet ¶ added in v3.5.4
func (list *ImmutableStringList) IsSet() bool
IsSet returns false for lists or queues.
func (*ImmutableStringList) Last ¶ added in v3.5.4
func (list *ImmutableStringList) 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 (*ImmutableStringList) LastIndexWhere ¶ added in v3.5.4
func (list *ImmutableStringList) LastIndexWhere(p func(string) bool) int
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (*ImmutableStringList) LastIndexWhere2 ¶ added in v3.5.4
func (list *ImmutableStringList) 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 (*ImmutableStringList) LastOption ¶ added in v3.5.4
func (list *ImmutableStringList) LastOption() (string, bool)
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (*ImmutableStringList) Len ¶ added in v3.5.4
func (list *ImmutableStringList) Len() int
Len returns the number of items in the list - an alias of Size().
func (*ImmutableStringList) Map ¶ added in v3.5.4
func (list *ImmutableStringList) Map(f func(string) string) *ImmutableStringList
Map returns a new ImmutableStringList by transforming every element with function f. The resulting list is the same size as the original list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (*ImmutableStringList) MapToInt ¶ added in v3.5.4
func (list *ImmutableStringList) MapToInt(f func(string) int) []int
MapToInt returns a new []int by transforming every element with function f. The resulting slice is the same size as the list.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
func (ImmutableStringList) MarshalJSON ¶ added in v3.5.4
func (list ImmutableStringList) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this list type.
func (*ImmutableStringList) Max ¶ added in v3.5.4
func (list *ImmutableStringList) Max() (result string)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (*ImmutableStringList) MaxBy ¶ added in v3.5.4
func (list *ImmutableStringList) MaxBy(less func(string, string) bool) string
MaxBy returns an element of ImmutableStringList 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 (*ImmutableStringList) Min ¶ added in v3.5.4
func (list *ImmutableStringList) Min() string
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (*ImmutableStringList) MinBy ¶ added in v3.5.4
func (list *ImmutableStringList) MinBy(less func(string, string) bool) string
MinBy returns an element of ImmutableStringList 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 (*ImmutableStringList) MkString ¶ added in v3.5.4
func (list *ImmutableStringList) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*ImmutableStringList) MkString3 ¶ added in v3.5.4
func (list *ImmutableStringList) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*ImmutableStringList) NonEmpty ¶ added in v3.5.4
func (list *ImmutableStringList) NonEmpty() bool
NonEmpty tests whether ImmutableStringList is empty.
func (*ImmutableStringList) Partition ¶ added in v3.5.4
func (list *ImmutableStringList) Partition(p func(string) bool) (*ImmutableStringList, *ImmutableStringList)
Partition returns two new stringLists whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list.
func (*ImmutableStringList) Reverse ¶ added in v3.5.4
func (list *ImmutableStringList) Reverse() *ImmutableStringList
Reverse returns a copy of ImmutableStringList with all elements in the reverse order.
func (*ImmutableStringList) Send ¶ added in v3.5.4
func (list *ImmutableStringList) 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 (*ImmutableStringList) Shuffle ¶ added in v3.5.4
func (list *ImmutableStringList) Shuffle() *ImmutableStringList
Shuffle returns a shuffled copy of ImmutableStringList, using a version of the Fisher-Yates shuffle.
func (*ImmutableStringList) Size ¶ added in v3.5.4
func (list *ImmutableStringList) Size() int
Size returns the number of items in the list - an alias of Len().
func (*ImmutableStringList) SortBy ¶ added in v3.5.4
func (list *ImmutableStringList) SortBy(less func(i, j string) bool) *ImmutableStringList
SortBy returns a new list in which the elements are sorted by a specified ordering.
func (*ImmutableStringList) Sorted ¶ added in v3.5.4
func (list *ImmutableStringList) Sorted() *ImmutableStringList
Sorted returns a new list in which the elements are sorted by their natural ordering.
func (*ImmutableStringList) StableSortBy ¶ added in v3.5.4
func (list *ImmutableStringList) StableSortBy(less func(i, j string) bool) *ImmutableStringList
StableSortBy returns a new list in which the elements are sorted by a specified ordering. The algorithm keeps the original order of equal elements.
func (*ImmutableStringList) StableSorted ¶ added in v3.5.4
func (list *ImmutableStringList) StableSorted() *ImmutableStringList
StableSorted returns a new list in which the elements are sorted by their natural ordering.
func (*ImmutableStringList) String ¶ added in v3.5.4
func (list *ImmutableStringList) String() string
String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.
func (*ImmutableStringList) StringList ¶ added in v3.5.4
func (list *ImmutableStringList) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (*ImmutableStringList) Tail ¶ added in v3.5.4
func (list *ImmutableStringList) Tail() *ImmutableStringList
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 (*ImmutableStringList) Take ¶ added in v3.5.4
func (list *ImmutableStringList) Take(n int) *ImmutableStringList
Take returns a slice of ImmutableStringList 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 (*ImmutableStringList) TakeLast ¶ added in v3.5.4
func (list *ImmutableStringList) TakeLast(n int) *ImmutableStringList
TakeLast returns a slice of ImmutableStringList containing the trailing n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.
func (*ImmutableStringList) TakeWhile ¶ added in v3.5.4
func (list *ImmutableStringList) TakeWhile(p func(string) bool) *ImmutableStringList
TakeWhile returns a new ImmutableStringList containing the leading elements of the source list. Whilst the predicate p returns true, elements are added to the result. Once predicate p returns false, all remaining elements are excluded.
func (*ImmutableStringList) ToInterfaceSlice ¶ added in v3.5.4
func (list *ImmutableStringList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (*ImmutableStringList) ToList ¶ added in v3.5.4
func (list *ImmutableStringList) ToList() *ImmutableStringList
ToList returns the elements of the list as a list, which is an identity operation in this case.
func (*ImmutableStringList) ToSlice ¶ added in v3.5.4
func (list *ImmutableStringList) ToSlice() []string
ToSlice returns the elements of the current list as a slice.
func (*ImmutableStringList) UnmarshalJSON ¶ added in v3.5.4
func (list *ImmutableStringList) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this list type.
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) // MapToString returns a new []string by transforming every element with function f. // The resulting slice is the same size as the collection. The collection is not modified. MapToString(f func(int) string) []string // MapToInt64 returns a new []int64 by transforming every element with function f. // The resulting slice is the same size as the collection. The collection is not modified. MapToInt64(f func(int) int64) []int64 // FlatMapString returns a new []string by transforming every element with function f // that returns zero or more items in a slice. The resulting slice may have a different size to the // collection. The collection is not modified. FlatMapToString(f func(int) []string) []string // FlatMapInt64 returns a new []int64 by transforming every element with function f // that returns zero or more items in a slice. The resulting slice may have a different size to the // collection. The collection is not modified. FlatMapToInt64(f func(int) []int64) []int64 // 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 // Clear the entire collection. Clear() // Add adds items to the current collection. Add(more ...int) // 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 ¶
type IntIntMap struct {
// contains filtered or unexported fields
}
IntIntMap is the primary type that represents a thread-safe 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) GobDecode ¶ added in v3.6.0
GobDecode implements 'gob' decoding for this map type. You must register int with the 'gob' package before this method is used.
func (*IntIntMap) GobEncode ¶ added in v3.6.0
GobEncode implements 'gob' encoding for this map type. You must register int with the 'gob' package before this method is used.
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 v3.7.0
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (*IntIntMap) OrderedSlice ¶ added in v3.6.0
func (mm *IntIntMap) OrderedSlice(keys []int) 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. The boolean result is true only if the key had been present.
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 v3.6.0
func (t IntIntTuple) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding.Marshaler interface.
func (IntIntTuple) UnmarshalJSON ¶ added in v3.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 v3.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 v3.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 v3.6.0
func (ts IntIntTuples) String() string
func (IntIntTuples) ToMap ¶ added in v3.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 struct {
// contains filtered or unexported fields
}
IntList contains a slice of type int. It encapsulates the slice and provides methods to access or mutate it.
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) Append ¶
Append adds items to the current list. If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned.
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) DoDeleteAt ¶
DoDeleteAt modifies a IntList by deleting n elements from a given index.
The list is modified and the modified list is returned. Panics if the index is out of range or n is large enough to take the index out of range.
func (*IntList) DoDeleteFirst ¶
DoDeleteFirst modifies a IntList by deleting n elements from the start of the list.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if n is large enough to take the index out of range.
func (*IntList) DoDeleteLast ¶
DoDeleteLast modifies a IntList by deleting n elements from the end of the list.
The list is modified and the modified list is returned. Panics if n is large enough to take the index out of range.
func (*IntList) DoInsertAt ¶
DoInsertAt modifies a IntList by inserting elements at a given index. This is a generalised version of Append.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if the index is out of range.
func (*IntList) DoKeepWhere ¶
DoKeepWhere modifies a IntList by retaining only those elements that match the predicate p. This is very similar to Filter but alters the list in place.
The list is modified and the modified list is returned.
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. Nil lists are considered to be empty.
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. See also DoKeepWhere (which does modify the original list).
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) FlatMapToInt64 ¶
FlatMapToInt64 returns a new []int64 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) 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 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 v3.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. The function can safely alter the values via side-effects.
func (*IntList) Get ¶
Get gets the specified element in the list. Panics if the index is out of range or the list is nil.
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) MapToInt64 ¶
MapToInt64 returns a new []int64 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) MapToString ¶
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) MarshalJSON ¶
MarshalJSON implements JSON encoding for this list type.
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.
func (*IntList) UnmarshalJSON ¶
UnmarshalJSON implements JSON decoding for this list type.
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 // implements json.Marshaler interface { MarshalJSON() ([]byte, error) // implements json.Unmarshaler interface { UnmarshalJSON(b []byte) error // 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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Clone returns a shallow copy of the queue. It does not clone the underlying elements.
func (*IntQueue) CountBy ¶
CountBy gives the number elements of IntQueue that return true for the predicate p.
func (*IntQueue) DoKeepWhere ¶
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) Exists ¶
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 ¶
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 ¶
Find returns the first int that returns true for predicate p. False is returned if none match.
func (*IntQueue) FlatMap ¶
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) FlatMapToInt64 ¶
FlatMapToInt64 returns a new []int64 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) 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 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 v3.9.0
Fold aggregates all the values in the queue using a supplied function, starting from some initial value.
func (*IntQueue) Forall ¶
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 ¶
Foreach iterates over IntQueue and executes function f against each element. The function can safely alter the values via side-effects.
func (*IntQueue) Get ¶
Get gets the specified element in the queue. Panics if the index is out of range or the queue is nil.
func (*IntQueue) Head ¶
Head gets the first element in the queue. Head is the opposite of Last. Panics if queue is empty or nil.
func (*IntQueue) HeadOption ¶
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 ¶
IsOverwriting returns true if the queue is overwriting, false if refusing.
func (*IntQueue) IsSequence ¶
IsSequence returns true for ordered lists and queues.
func (*IntQueue) Last ¶
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 ¶
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) Less ¶
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 ¶
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) MapToInt64 ¶
MapToInt64 returns a new []int64 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) MapToString ¶
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) MaxBy ¶
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) MinBy ¶
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) Offer ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Size gets the number of elements currently in this queue. This is an alias for Len.
func (*IntQueue) Sort ¶
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 ¶
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) ToInterfaceSlice ¶
func (queue *IntQueue) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the queue as a slice of arbitrary type. The queue is not altered.
type IntSequence ¶ added in v3.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 struct {
// contains filtered or unexported fields
}
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) 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 the given items are all 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) FlatMapToInt64 ¶
FlatMapToInt64 returns a new []int64 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) 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 v3.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. The function can safely alter the values via side-effects.
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) MapToInt64 ¶
MapToInt64 returns a new []int64 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) 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 relative order of the elements in the results is the same as in the original list.
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 ¶
StringSet 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) 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 SimpleAppleList ¶
type SimpleAppleList []Apple
SimpleAppleList is a slice of type Apple. Use it where you would use []Apple. 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 BuildSimpleAppleListFromChan ¶
func BuildSimpleAppleListFromChan(source <-chan Apple) SimpleAppleList
BuildSimpleAppleListFromChan constructs a new SimpleAppleList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertSimpleAppleList ¶
func ConvertSimpleAppleList(values ...interface{}) (SimpleAppleList, bool)
ConvertSimpleAppleList 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 MakeSimpleAppleList ¶
func MakeSimpleAppleList(length, capacity int) SimpleAppleList
MakeSimpleAppleList makes an empty list with both length and capacity initialised.
func NewSimpleAppleList ¶
func NewSimpleAppleList(values ...Apple) SimpleAppleList
NewSimpleAppleList constructs a new list containing the supplied values, if any.
func (SimpleAppleList) Clone ¶
func (list SimpleAppleList) Clone() SimpleAppleList
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (SimpleAppleList) Contains ¶
func (list SimpleAppleList) Contains(v Apple) bool
Contains determines whether a given item is already in the list, returning true if so.
func (SimpleAppleList) ContainsAll ¶
func (list SimpleAppleList) ContainsAll(i ...Apple) 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 (SimpleAppleList) CountBy ¶
func (list SimpleAppleList) CountBy(p func(Apple) bool) (result int)
CountBy gives the number elements of SimpleAppleList that return true for the predicate p.
func (SimpleAppleList) DistinctBy ¶
func (list SimpleAppleList) DistinctBy(equal func(Apple, Apple) bool) SimpleAppleList
DistinctBy returns a new SimpleAppleList whose elements are unique, where equality is defined by the equal function.
func (SimpleAppleList) DoReverse ¶
func (list SimpleAppleList) DoReverse() SimpleAppleList
DoReverse alters a SimpleAppleList 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 (SimpleAppleList) DoShuffle ¶
func (list SimpleAppleList) DoShuffle() SimpleAppleList
DoShuffle returns a shuffled SimpleAppleList, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (SimpleAppleList) Drop ¶
func (list SimpleAppleList) Drop(n int) SimpleAppleList
Drop returns a slice of SimpleAppleList 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 (SimpleAppleList) DropLast ¶
func (list SimpleAppleList) DropLast(n int) SimpleAppleList
DropLast returns a slice of SimpleAppleList 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 (SimpleAppleList) DropWhile ¶
func (list SimpleAppleList) DropWhile(p func(Apple) bool) SimpleAppleList
DropWhile returns a new SimpleAppleList 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 (SimpleAppleList) Equals ¶
func (list SimpleAppleList) Equals(other SimpleAppleList) 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 (SimpleAppleList) Exists ¶
func (list SimpleAppleList) Exists(p func(Apple) bool) bool
Exists verifies that one or more elements of SimpleAppleList return true for the predicate p.
func (SimpleAppleList) Filter ¶
func (list SimpleAppleList) Filter(p func(Apple) bool) SimpleAppleList
Filter returns a new SimpleAppleList whose elements return true for predicate p.
The original list is not modified.
func (SimpleAppleList) Find ¶
func (list SimpleAppleList) Find(p func(Apple) bool) (Apple, bool)
Find returns the first Apple that returns true for predicate p. False is returned if none match.
func (SimpleAppleList) FlatMap ¶
func (list SimpleAppleList) FlatMap(f func(Apple) []Apple) SimpleAppleList
FlatMap returns a new SimpleAppleList 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 (SimpleAppleList) FlatMapToString ¶ added in v3.5.0
func (list SimpleAppleList) FlatMapToString(f func(Apple) []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 (SimpleAppleList) Fold ¶ added in v3.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (SimpleAppleList) Forall ¶
func (list SimpleAppleList) Forall(p func(Apple) bool) bool
Forall verifies that all elements of SimpleAppleList return true for the predicate p.
func (SimpleAppleList) Foreach ¶
func (list SimpleAppleList) Foreach(f func(Apple))
Foreach iterates over SimpleAppleList and executes function f against each element.
func (SimpleAppleList) Get ¶
func (list SimpleAppleList) Get(i int) Apple
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 (SimpleAppleList) Head ¶
func (list SimpleAppleList) Head() Apple
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 (SimpleAppleList) HeadOption ¶
func (list SimpleAppleList) HeadOption() (Apple, bool)
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (SimpleAppleList) IndexWhere ¶
func (list SimpleAppleList) IndexWhere(p func(Apple) bool) int
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (SimpleAppleList) IndexWhere2 ¶
func (list SimpleAppleList) IndexWhere2(p func(Apple) 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 (SimpleAppleList) Init ¶
func (list SimpleAppleList) Init() SimpleAppleList
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 (SimpleAppleList) IsEmpty ¶
func (list SimpleAppleList) IsEmpty() bool
IsEmpty tests whether SimpleAppleList is empty.
func (SimpleAppleList) IsSequence ¶
func (list SimpleAppleList) IsSequence() bool
IsSequence returns true for lists and queues.
func (SimpleAppleList) IsSet ¶
func (list SimpleAppleList) IsSet() bool
IsSet returns false for lists or queues.
func (SimpleAppleList) Last ¶
func (list SimpleAppleList) Last() Apple
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 (SimpleAppleList) LastIndexWhere ¶
func (list SimpleAppleList) LastIndexWhere(p func(Apple) bool) int
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (SimpleAppleList) LastIndexWhere2 ¶
func (list SimpleAppleList) LastIndexWhere2(p func(Apple) 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 (SimpleAppleList) LastOption ¶
func (list SimpleAppleList) LastOption() (Apple, bool)
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (SimpleAppleList) Len ¶
func (list SimpleAppleList) 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 (SimpleAppleList) Map ¶
func (list SimpleAppleList) Map(f func(Apple) Apple) SimpleAppleList
Map returns a new SimpleAppleList 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 (SimpleAppleList) MapToString ¶ added in v3.5.0
func (list SimpleAppleList) MapToString(f func(Apple) 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 (SimpleAppleList) MaxBy ¶
func (list SimpleAppleList) MaxBy(less func(Apple, Apple) bool) Apple
MaxBy returns an element of SimpleAppleList 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 (SimpleAppleList) MinBy ¶
func (list SimpleAppleList) MinBy(less func(Apple, Apple) bool) Apple
MinBy returns an element of SimpleAppleList 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 (SimpleAppleList) NonEmpty ¶
func (list SimpleAppleList) NonEmpty() bool
NonEmpty tests whether SimpleAppleList is empty.
func (SimpleAppleList) Partition ¶
func (list SimpleAppleList) Partition(p func(Apple) bool) (SimpleAppleList, SimpleAppleList)
Partition returns two new AppleLists 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 (SimpleAppleList) Reverse ¶
func (list SimpleAppleList) Reverse() SimpleAppleList
Reverse returns a copy of SimpleAppleList with all elements in the reverse order.
The original list is not modified.
func (SimpleAppleList) Send ¶
func (list SimpleAppleList) Send() <-chan Apple
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 (SimpleAppleList) Shuffle ¶
func (list SimpleAppleList) Shuffle() SimpleAppleList
Shuffle returns a shuffled copy of SimpleAppleList, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (SimpleAppleList) Size ¶
func (list SimpleAppleList) Size() int
Size returns the number of items in the list - an alias of Len().
func (SimpleAppleList) SortBy ¶
func (list SimpleAppleList) SortBy(less func(i, j Apple) bool) SimpleAppleList
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (SimpleAppleList) StableSortBy ¶
func (list SimpleAppleList) StableSortBy(less func(i, j Apple) bool) SimpleAppleList
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 (SimpleAppleList) Swap ¶
func (list SimpleAppleList) 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 (SimpleAppleList) Tail ¶
func (list SimpleAppleList) Tail() SimpleAppleList
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 (SimpleAppleList) Take ¶
func (list SimpleAppleList) Take(n int) SimpleAppleList
Take returns a slice of SimpleAppleList 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 (SimpleAppleList) TakeLast ¶
func (list SimpleAppleList) TakeLast(n int) SimpleAppleList
TakeLast returns a slice of SimpleAppleList 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 (SimpleAppleList) TakeWhile ¶
func (list SimpleAppleList) TakeWhile(p func(Apple) bool) SimpleAppleList
TakeWhile returns a new SimpleAppleList 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 (SimpleAppleList) ToInterfaceSlice ¶
func (list SimpleAppleList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (SimpleAppleList) ToList ¶
func (list SimpleAppleList) ToList() SimpleAppleList
ToList returns the elements of the list as a list, which is an identity operation in this case.
func (SimpleAppleList) ToSlice ¶
func (list SimpleAppleList) ToSlice() []Apple
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 SimpleAppleSet ¶
type SimpleAppleSet map[Apple]struct{}
SimpleAppleSet is the primary type that represents a set
func BuildSimpleAppleSetFromChan ¶
func BuildSimpleAppleSetFromChan(source <-chan Apple) SimpleAppleSet
BuildSimpleAppleSetFromChan constructs a new SimpleAppleSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertSimpleAppleSet ¶
func ConvertSimpleAppleSet(values ...interface{}) (SimpleAppleSet, bool)
ConvertSimpleAppleSet 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 NewSimpleAppleSet ¶
func NewSimpleAppleSet(values ...Apple) SimpleAppleSet
NewSimpleAppleSet creates and returns a reference to an empty set.
func (SimpleAppleSet) Add ¶
func (set SimpleAppleSet) Add(more ...Apple) SimpleAppleSet
Add adds items to the current set, returning the modified set.
func (SimpleAppleSet) Append ¶
func (set SimpleAppleSet) Append(more ...Apple) SimpleAppleSet
Append inserts more items into a clone of the set. It returns the augmented set. The original set is unmodified.
func (SimpleAppleSet) Cardinality ¶
func (set SimpleAppleSet) Cardinality() int
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*SimpleAppleSet) Clear ¶
func (set *SimpleAppleSet) Clear()
Clear the entire set. Aterwards, it will be an empty set.
func (SimpleAppleSet) Clone ¶
func (set SimpleAppleSet) Clone() SimpleAppleSet
Clone returns a shallow copy of the set. It does not clone the underlying elements.
func (SimpleAppleSet) Contains ¶
func (set SimpleAppleSet) Contains(i Apple) bool
Contains determines whether a given item is already in the set, returning true if so.
func (SimpleAppleSet) ContainsAll ¶
func (set SimpleAppleSet) ContainsAll(i ...Apple) bool
ContainsAll determines whether a given item is already in the set, returning true if so.
func (SimpleAppleSet) CountBy ¶
func (set SimpleAppleSet) CountBy(p func(Apple) bool) (result int)
CountBy gives the number elements of SimpleAppleSet that return true for the predicate p.
func (SimpleAppleSet) Difference ¶
func (set SimpleAppleSet) Difference(other SimpleAppleSet) SimpleAppleSet
Difference returns a new set with items in the current set but not in the other set
func (SimpleAppleSet) Equals ¶
func (set SimpleAppleSet) Equals(other SimpleAppleSet) bool
Equals determines whether two sets are equal to each other, returning true if so. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal.
func (SimpleAppleSet) Exists ¶
func (set SimpleAppleSet) Exists(p func(Apple) bool) bool
Exists applies a predicate p to every element in the set. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (SimpleAppleSet) Filter ¶
func (set SimpleAppleSet) Filter(p func(Apple) bool) SimpleAppleSet
Filter returns a new SimpleAppleSet whose elements return true for the predicate p.
The original set is not modified
func (SimpleAppleSet) Find ¶
func (set SimpleAppleSet) Find(p func(Apple) bool) (Apple, bool)
Find returns the first Apple that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.
func (SimpleAppleSet) FlatMap ¶
func (set SimpleAppleSet) FlatMap(f func(Apple) []Apple) SimpleAppleSet
FlatMap returns a new SimpleAppleSet 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 (SimpleAppleSet) FlatMapToString ¶
func (set SimpleAppleSet) FlatMapToString(f func(Apple) []string) []string
FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the set. 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 (SimpleAppleSet) Fold ¶ added in v3.9.0
Fold aggregates all the values in the set using a supplied function, starting from some initial value.
func (SimpleAppleSet) Forall ¶
func (set SimpleAppleSet) Forall(p func(Apple) bool) bool
Forall applies a predicate function p to every element in the set. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (SimpleAppleSet) Foreach ¶
func (set SimpleAppleSet) Foreach(f func(Apple))
Foreach iterates over the set and executes the function f against each element.
func (SimpleAppleSet) Intersect ¶
func (set SimpleAppleSet) Intersect(other SimpleAppleSet) SimpleAppleSet
Intersect returns a new set with items that exist only in both sets.
func (SimpleAppleSet) IsEmpty ¶
func (set SimpleAppleSet) IsEmpty() bool
IsEmpty returns true if the set is empty.
func (SimpleAppleSet) IsSequence ¶
func (set SimpleAppleSet) IsSequence() bool
IsSequence returns true for lists and queues.
func (SimpleAppleSet) IsSet ¶
func (set SimpleAppleSet) IsSet() bool
IsSet returns false for lists or queues.
func (SimpleAppleSet) IsSubset ¶
func (set SimpleAppleSet) IsSubset(other SimpleAppleSet) bool
IsSubset determines whether every item in the other set is in this set, returning true if so.
func (SimpleAppleSet) IsSuperset ¶
func (set SimpleAppleSet) IsSuperset(other SimpleAppleSet) bool
IsSuperset determines whether every item of this set is in the other set, returning true if so.
func (SimpleAppleSet) Map ¶
func (set SimpleAppleSet) Map(f func(Apple) Apple) SimpleAppleSet
Map returns a new SimpleAppleSet 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 (SimpleAppleSet) MapToString ¶
func (set SimpleAppleSet) MapToString(f func(Apple) string) []string
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 (SimpleAppleSet) MaxBy ¶
func (set SimpleAppleSet) MaxBy(less func(Apple, Apple) bool) Apple
MaxBy returns an element of SimpleAppleSet 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 (SimpleAppleSet) MinBy ¶
func (set SimpleAppleSet) MinBy(less func(Apple, Apple) bool) Apple
MinBy returns an element of SimpleAppleSet 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 (SimpleAppleSet) NonEmpty ¶
func (set SimpleAppleSet) NonEmpty() bool
NonEmpty returns true if the set is not empty.
func (SimpleAppleSet) Partition ¶
func (set SimpleAppleSet) Partition(p func(Apple) bool) (SimpleAppleSet, SimpleAppleSet)
Partition returns two new SimpleAppleSets 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 (SimpleAppleSet) Remove ¶
func (set SimpleAppleSet) Remove(i Apple)
Remove a single item from the set.
func (SimpleAppleSet) Send ¶
func (set SimpleAppleSet) Send() <-chan Apple
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 (SimpleAppleSet) Size ¶
func (set SimpleAppleSet) Size() int
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (SimpleAppleSet) SymmetricDifference ¶
func (set SimpleAppleSet) SymmetricDifference(other SimpleAppleSet) SimpleAppleSet
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (SimpleAppleSet) ToInterfaceSlice ¶
func (set SimpleAppleSet) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.
func (SimpleAppleSet) ToSet ¶
func (set SimpleAppleSet) ToSet() SimpleAppleSet
ToSet returns the set; this is an identity operation in this case.
func (SimpleAppleSet) ToSlice ¶
func (set SimpleAppleSet) ToSlice() []Apple
ToSlice returns the elements of the current set as a slice.
func (SimpleAppleSet) Union ¶
func (set SimpleAppleSet) Union(other SimpleAppleSet) SimpleAppleSet
Union returns a new set with all items in both sets.
type SimpleIntIntMap ¶
SimpleIntIntMap is the primary type that represents a map
func NewSimpleIntIntMap ¶
func NewSimpleIntIntMap(kv ...SimpleIntIntTuple) SimpleIntIntMap
NewSimpleIntIntMap creates and returns a reference to a map, optionally containing some items.
func NewSimpleIntIntMap1 ¶
func NewSimpleIntIntMap1(k int, v int) SimpleIntIntMap
NewSimpleIntIntMap1 creates and returns a reference to a map containing one item.
func (SimpleIntIntMap) Clone ¶
func (mm SimpleIntIntMap) Clone() SimpleIntIntMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (SimpleIntIntMap) ContainsAllKeys ¶
func (mm SimpleIntIntMap) ContainsAllKeys(kk ...int) bool
ContainsAllKeys determines if the given items are all in the map.
func (SimpleIntIntMap) ContainsKey ¶
func (mm SimpleIntIntMap) ContainsKey(k int) bool
ContainsKey determines if a given item is already in the map.
func (SimpleIntIntMap) DropWhere ¶
func (mm SimpleIntIntMap) DropWhere(fn func(int, int) bool) SimpleIntIntTuples
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 (SimpleIntIntMap) Equals ¶
func (mm SimpleIntIntMap) Equals(other SimpleIntIntMap) 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 (SimpleIntIntMap) Exists ¶
func (mm SimpleIntIntMap) Exists(p func(int, int) bool) bool
Exists applies the predicate p to every element in the map. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (SimpleIntIntMap) Filter ¶
func (mm SimpleIntIntMap) Filter(p func(int, int) bool) SimpleIntIntMap
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 (SimpleIntIntMap) Find ¶
func (mm SimpleIntIntMap) Find(p func(int, int) bool) (SimpleIntIntTuple, 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 (SimpleIntIntMap) FlatMap ¶
func (mm SimpleIntIntMap) FlatMap(f func(int, int) []SimpleIntIntTuple) SimpleIntIntMap
FlatMap returns a new SimpleIntMap 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 (SimpleIntIntMap) Forall ¶
func (mm SimpleIntIntMap) Forall(p func(int, int) bool) bool
Forall applies the predicate p to every element in the map. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (SimpleIntIntMap) Foreach ¶
func (mm SimpleIntIntMap) Foreach(f func(int, int))
Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.
func (SimpleIntIntMap) Get ¶
func (mm SimpleIntIntMap) Get(k int) (int, bool)
Get returns one of the items in the map, if present.
func (SimpleIntIntMap) IsEmpty ¶
func (mm SimpleIntIntMap) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (SimpleIntIntMap) Keys ¶
func (mm SimpleIntIntMap) Keys() []int
Keys returns the keys of the current map as a slice.
func (SimpleIntIntMap) Map ¶
func (mm SimpleIntIntMap) Map(f func(int, int) (int, int)) SimpleIntIntMap
Map returns a new SimpleIntMap 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 (SimpleIntIntMap) MkString ¶
func (mm SimpleIntIntMap) MkString(sep string) string
MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.
func (SimpleIntIntMap) MkString4 ¶ added in v3.7.0
func (mm SimpleIntIntMap) MkString4(before, between, after, equals string) string
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (SimpleIntIntMap) NonEmpty ¶
func (mm SimpleIntIntMap) NonEmpty() bool
NonEmpty returns true if the map is not empty.
func (SimpleIntIntMap) OrderedSlice ¶ added in v3.6.0
func (mm SimpleIntIntMap) OrderedSlice(keys []int) SimpleIntIntTuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (SimpleIntIntMap) Partition ¶
func (mm SimpleIntIntMap) Partition(p func(int, int) bool) (matching SimpleIntIntMap, others SimpleIntIntMap)
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 (SimpleIntIntMap) Pop ¶
func (mm SimpleIntIntMap) Pop(k int) (int, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (SimpleIntIntMap) Put ¶
func (mm SimpleIntIntMap) Put(k int, v int) bool
Put adds an item to the current map, replacing any prior value.
func (SimpleIntIntMap) Remove ¶
func (mm SimpleIntIntMap) Remove(k int)
Remove a single item from the map.
func (SimpleIntIntMap) Size ¶
func (mm SimpleIntIntMap) Size() int
Size returns how many items are currently in the map. This is a synonym for Len.
func (SimpleIntIntMap) String ¶
func (mm SimpleIntIntMap) String() string
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (SimpleIntIntMap) ToSlice ¶
func (mm SimpleIntIntMap) ToSlice() SimpleIntIntTuples
ToSlice returns the key/value pairs as a slice.
func (SimpleIntIntMap) Values ¶
func (mm SimpleIntIntMap) Values() []int
Values returns the values of the current map as a slice.
type SimpleIntIntTuple ¶
SimpleIntIntTuple represents a key/value pair.
func (SimpleIntIntTuple) MarshalJSON ¶ added in v3.6.0
func (t SimpleIntIntTuple) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding.Marshaler interface.
func (SimpleIntIntTuple) UnmarshalJSON ¶ added in v3.6.0
func (t SimpleIntIntTuple) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this tuple type.
type SimpleIntIntTuples ¶
type SimpleIntIntTuples []SimpleIntIntTuple
SimpleIntIntTuples can be used as a builder for unmodifiable maps.
func SimpleIntIntZip ¶
func SimpleIntIntZip(keys ...int) SimpleIntIntTuples
SimpleIntIntZip 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 NewSimpleIntIntMap constructor function.
func (SimpleIntIntTuples) Append1 ¶
func (ts SimpleIntIntTuples) Append1(k int, v int) SimpleIntIntTuples
Append1 adds one item.
func (SimpleIntIntTuples) Append2 ¶
func (ts SimpleIntIntTuples) Append2(k1 int, v1 int, k2 int, v2 int) SimpleIntIntTuples
Append2 adds two items.
func (SimpleIntIntTuples) Append3 ¶
func (ts SimpleIntIntTuples) Append3(k1 int, v1 int, k2 int, v2 int, k3 int, v3 int) SimpleIntIntTuples
Append3 adds three items.
func (SimpleIntIntTuples) MkString ¶ added in v3.6.0
func (ts SimpleIntIntTuples) MkString(sep string) string
MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.
func (SimpleIntIntTuples) MkString4 ¶ added in v3.7.0
func (ts SimpleIntIntTuples) MkString4(before, between, after, equals string) string
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (SimpleIntIntTuples) String ¶ added in v3.6.0
func (ts SimpleIntIntTuples) String() string
func (SimpleIntIntTuples) ToMap ¶ added in v3.6.0
func (ts SimpleIntIntTuples) ToMap() SimpleIntIntMap
ToMap converts the tuples to a map.
func (SimpleIntIntTuples) Values ¶
func (ts SimpleIntIntTuples) Values(values ...int) SimpleIntIntTuples
Values sets the values in a tuple slice. Use this with SimpleIntIntZip.
type SimpleIntList ¶
type SimpleIntList []int
SimpleIntList 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 BuildSimpleIntListFromChan ¶
func BuildSimpleIntListFromChan(source <-chan int) SimpleIntList
BuildSimpleIntListFromChan constructs a new SimpleIntList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertSimpleIntList ¶
func ConvertSimpleIntList(values ...interface{}) (SimpleIntList, bool)
ConvertSimpleIntList 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 MakeSimpleIntList ¶
func MakeSimpleIntList(length, capacity int) SimpleIntList
MakeSimpleIntList makes an empty list with both length and capacity initialised.
func NewSimpleIntList ¶
func NewSimpleIntList(values ...int) SimpleIntList
NewSimpleIntList constructs a new list containing the supplied values, if any.
func (SimpleIntList) Clone ¶
func (list SimpleIntList) Clone() SimpleIntList
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (SimpleIntList) Contains ¶
func (list SimpleIntList) Contains(v int) bool
Contains determines whether a given item is already in the list, returning true if so.
func (SimpleIntList) ContainsAll ¶
func (list SimpleIntList) ContainsAll(i ...int) bool
ContainsAll determines whether the given items are all in the list, returning true if so. This is potentially a slow method and should only be used rarely.
func (SimpleIntList) CountBy ¶
func (list SimpleIntList) CountBy(p func(int) bool) (result int)
CountBy gives the number elements of SimpleIntList that return true for the predicate p.
func (SimpleIntList) DistinctBy ¶
func (list SimpleIntList) DistinctBy(equal func(int, int) bool) SimpleIntList
DistinctBy returns a new SimpleIntList whose elements are unique, where equality is defined by the equal function.
func (SimpleIntList) DoReverse ¶
func (list SimpleIntList) DoReverse() SimpleIntList
DoReverse alters a SimpleIntList 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 (SimpleIntList) DoShuffle ¶
func (list SimpleIntList) DoShuffle() SimpleIntList
DoShuffle returns a shuffled SimpleIntList, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (SimpleIntList) Drop ¶
func (list SimpleIntList) Drop(n int) SimpleIntList
Drop returns a slice of SimpleIntList 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 (SimpleIntList) DropLast ¶
func (list SimpleIntList) DropLast(n int) SimpleIntList
DropLast returns a slice of SimpleIntList 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 (SimpleIntList) DropWhile ¶
func (list SimpleIntList) DropWhile(p func(int) bool) SimpleIntList
DropWhile returns a new SimpleIntList 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 (SimpleIntList) Equals ¶
func (list SimpleIntList) Equals(other SimpleIntList) 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 (SimpleIntList) Exists ¶
func (list SimpleIntList) Exists(p func(int) bool) bool
Exists verifies that one or more elements of SimpleIntList return true for the predicate p.
func (SimpleIntList) Filter ¶
func (list SimpleIntList) Filter(p func(int) bool) SimpleIntList
Filter returns a new SimpleIntList whose elements return true for predicate p.
The original list is not modified.
func (SimpleIntList) Find ¶
func (list SimpleIntList) Find(p func(int) bool) (int, bool)
Find returns the first int that returns true for predicate p. False is returned if none match.
func (SimpleIntList) FlatMap ¶
func (list SimpleIntList) FlatMap(f func(int) []int) SimpleIntList
FlatMap returns a new SimpleIntList 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 (SimpleIntList) FlatMapToInt64 ¶ added in v3.5.0
func (list SimpleIntList) FlatMapToInt64(f func(int) []int64) []int64
FlatMapToInt64 returns a new []int64 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 (SimpleIntList) FlatMapToString ¶ added in v3.5.0
func (list SimpleIntList) FlatMapToString(f func(int) []string) []string
FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the list. 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 (SimpleIntList) Fold ¶ added in v3.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (SimpleIntList) Forall ¶
func (list SimpleIntList) Forall(p func(int) bool) bool
Forall verifies that all elements of SimpleIntList return true for the predicate p.
func (SimpleIntList) Foreach ¶
func (list SimpleIntList) Foreach(f func(int))
Foreach iterates over SimpleIntList and executes function f against each element.
func (SimpleIntList) Get ¶
func (list SimpleIntList) Get(i int) int
Get gets the specified element in the list. Panics if the index is out of range or the list is nil. The simple list is a dressed-up slice and normal slice operations will also work.
func (SimpleIntList) Head ¶
func (list SimpleIntList) Head() int
Head gets the first element in the list. Head plus Tail include the whole list. Head is the opposite of Last. Panics if list is empty or nil.
func (SimpleIntList) HeadOption ¶
func (list SimpleIntList) HeadOption() (int, bool)
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (SimpleIntList) IndexWhere ¶
func (list SimpleIntList) IndexWhere(p func(int) bool) int
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (SimpleIntList) IndexWhere2 ¶
func (list SimpleIntList) IndexWhere2(p func(int) bool, from int) int
IndexWhere2 finds the index of the first element satisfying predicate p at or after some start index. If none exists, -1 is returned.
func (SimpleIntList) Init ¶
func (list SimpleIntList) Init() SimpleIntList
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 (SimpleIntList) IsEmpty ¶
func (list SimpleIntList) IsEmpty() bool
IsEmpty tests whether SimpleIntList is empty.
func (SimpleIntList) IsSequence ¶
func (list SimpleIntList) IsSequence() bool
IsSequence returns true for lists and queues.
func (SimpleIntList) IsSet ¶
func (list SimpleIntList) IsSet() bool
IsSet returns false for lists or queues.
func (SimpleIntList) Last ¶
func (list SimpleIntList) Last() int
Last gets the last element in the list. Init plus Last include the whole list. Last is the opposite of Head. Panics if list is empty or nil.
func (SimpleIntList) LastIndexWhere ¶
func (list SimpleIntList) LastIndexWhere(p func(int) bool) int
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (SimpleIntList) LastIndexWhere2 ¶
func (list SimpleIntList) LastIndexWhere2(p func(int) bool, before int) int
LastIndexWhere2 finds the index of the last element satisfying predicate p at or before some start index. If none exists, -1 is returned.
func (SimpleIntList) LastOption ¶
func (list SimpleIntList) LastOption() (int, bool)
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (SimpleIntList) Len ¶
func (list SimpleIntList) 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 (SimpleIntList) Map ¶
func (list SimpleIntList) Map(f func(int) int) SimpleIntList
Map returns a new SimpleIntList 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 (SimpleIntList) MapToInt64 ¶ added in v3.5.0
func (list SimpleIntList) MapToInt64(f func(int) int64) []int64
MapToInt64 returns a new []int64 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 (SimpleIntList) MapToString ¶ added in v3.5.0
func (list SimpleIntList) MapToString(f func(int) string) []string
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the list. 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 (SimpleIntList) Max ¶
func (list SimpleIntList) Max() (result int)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (SimpleIntList) MaxBy ¶
func (list SimpleIntList) MaxBy(less func(int, int) bool) int
MaxBy returns an element of SimpleIntList 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 (SimpleIntList) Min ¶
func (list SimpleIntList) Min() int
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (SimpleIntList) MinBy ¶
func (list SimpleIntList) MinBy(less func(int, int) bool) int
MinBy returns an element of SimpleIntList 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 (SimpleIntList) MkString ¶
func (list SimpleIntList) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (SimpleIntList) MkString3 ¶
func (list SimpleIntList) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (SimpleIntList) NonEmpty ¶
func (list SimpleIntList) NonEmpty() bool
NonEmpty tests whether SimpleIntList is empty.
func (SimpleIntList) Partition ¶
func (list SimpleIntList) Partition(p func(int) bool) (SimpleIntList, SimpleIntList)
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 (SimpleIntList) Reverse ¶
func (list SimpleIntList) Reverse() SimpleIntList
Reverse returns a copy of SimpleIntList with all elements in the reverse order.
The original list is not modified.
func (SimpleIntList) Send ¶
func (list SimpleIntList) Send() <-chan int
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed. The channel will be closed when all the elements have been sent.
func (SimpleIntList) Shuffle ¶
func (list SimpleIntList) Shuffle() SimpleIntList
Shuffle returns a shuffled copy of SimpleIntList, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (SimpleIntList) Size ¶
func (list SimpleIntList) Size() int
Size returns the number of items in the list - an alias of Len().
func (SimpleIntList) SortBy ¶
func (list SimpleIntList) SortBy(less func(i, j int) bool) SimpleIntList
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (SimpleIntList) Sorted ¶
func (list SimpleIntList) Sorted() SimpleIntList
Sorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (SimpleIntList) StableSortBy ¶
func (list SimpleIntList) StableSortBy(less func(i, j int) bool) SimpleIntList
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 (SimpleIntList) StableSorted ¶
func (list SimpleIntList) StableSorted() SimpleIntList
StableSorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (SimpleIntList) String ¶
func (list SimpleIntList) String() string
String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.
func (SimpleIntList) StringList ¶
func (list SimpleIntList) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (SimpleIntList) Sum ¶
func (list SimpleIntList) Sum() int
Sum returns the sum of all the elements in the list.
func (SimpleIntList) Swap ¶
func (list SimpleIntList) 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 (SimpleIntList) Tail ¶
func (list SimpleIntList) Tail() SimpleIntList
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 (SimpleIntList) Take ¶
func (list SimpleIntList) Take(n int) SimpleIntList
Take returns a slice of SimpleIntList 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 (SimpleIntList) TakeLast ¶
func (list SimpleIntList) TakeLast(n int) SimpleIntList
TakeLast returns a slice of SimpleIntList 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 (SimpleIntList) TakeWhile ¶
func (list SimpleIntList) TakeWhile(p func(int) bool) SimpleIntList
TakeWhile returns a new SimpleIntList 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 (SimpleIntList) ToInterfaceSlice ¶
func (list SimpleIntList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (SimpleIntList) ToList ¶
func (list SimpleIntList) ToList() SimpleIntList
ToList returns the elements of the list as a list, which is an identity operation in this case.
func (SimpleIntList) ToSlice ¶
func (list SimpleIntList) ToSlice() []int
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 SimpleIntSet ¶
type SimpleIntSet map[int]struct{}
SimpleIntSet is the primary type that represents a set
func BuildSimpleIntSetFromChan ¶
func BuildSimpleIntSetFromChan(source <-chan int) SimpleIntSet
BuildSimpleIntSetFromChan constructs a new SimpleIntSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertSimpleIntSet ¶
func ConvertSimpleIntSet(values ...interface{}) (SimpleIntSet, bool)
ConvertSimpleIntSet 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 NewSimpleIntSet ¶
func NewSimpleIntSet(values ...int) SimpleIntSet
NewSimpleIntSet creates and returns a reference to an empty set.
func (SimpleIntSet) Add ¶
func (set SimpleIntSet) Add(more ...int) SimpleIntSet
Add adds items to the current set, returning the modified set.
func (SimpleIntSet) Append ¶
func (set SimpleIntSet) Append(more ...int) SimpleIntSet
Append inserts more items into a clone of the set. It returns the augmented set. The original set is unmodified.
func (SimpleIntSet) Cardinality ¶
func (set SimpleIntSet) Cardinality() int
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*SimpleIntSet) Clear ¶
func (set *SimpleIntSet) Clear()
Clear the entire set. Aterwards, it will be an empty set.
func (SimpleIntSet) Clone ¶
func (set SimpleIntSet) Clone() SimpleIntSet
Clone returns a shallow copy of the set. It does not clone the underlying elements.
func (SimpleIntSet) Contains ¶
func (set SimpleIntSet) Contains(i int) bool
Contains determines whether a given item is already in the set, returning true if so.
func (SimpleIntSet) ContainsAll ¶
func (set SimpleIntSet) ContainsAll(i ...int) bool
ContainsAll determines whether a given item is already in the set, returning true if so.
func (SimpleIntSet) CountBy ¶
func (set SimpleIntSet) CountBy(p func(int) bool) (result int)
CountBy gives the number elements of SimpleIntSet that return true for the predicate p.
func (SimpleIntSet) Difference ¶
func (set SimpleIntSet) Difference(other SimpleIntSet) SimpleIntSet
Difference returns a new set with items in the current set but not in the other set
func (SimpleIntSet) Equals ¶
func (set SimpleIntSet) Equals(other SimpleIntSet) bool
Equals determines whether two sets are equal to each other, returning true if so. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal.
func (SimpleIntSet) Exists ¶
func (set SimpleIntSet) Exists(p func(int) bool) bool
Exists applies a predicate p to every element in the set. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (SimpleIntSet) Filter ¶
func (set SimpleIntSet) Filter(p func(int) bool) SimpleIntSet
Filter returns a new SimpleIntSet whose elements return true for the predicate p.
The original set is not modified
func (SimpleIntSet) Find ¶
func (set SimpleIntSet) Find(p func(int) bool) (int, bool)
Find returns the first int that returns true for the predicate p. If there are many matches one is arbtrarily chosen. False is returned if none match.
func (SimpleIntSet) FlatMap ¶
func (set SimpleIntSet) FlatMap(f func(int) []int) SimpleIntSet
FlatMap returns a new SimpleIntSet 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 (SimpleIntSet) FlatMapToInt64 ¶
func (set SimpleIntSet) FlatMapToInt64(f func(int) []int64) []int64
FlatMapToInt64 returns a new []int64 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 (SimpleIntSet) FlatMapToString ¶
func (set SimpleIntSet) FlatMapToString(f func(int) []string) []string
FlatMapToString returns a new []string by transforming every element with function f that returns zero or more items in a slice. The resulting slice may have a different size to the set. 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 (SimpleIntSet) Fold ¶ added in v3.9.0
Fold aggregates all the values in the set using a supplied function, starting from some initial value.
func (SimpleIntSet) Forall ¶
func (set SimpleIntSet) Forall(p func(int) bool) bool
Forall applies a predicate function p to every element in the set. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (SimpleIntSet) Foreach ¶
func (set SimpleIntSet) Foreach(f func(int))
Foreach iterates over the set and executes the function f against each element.
func (SimpleIntSet) Intersect ¶
func (set SimpleIntSet) Intersect(other SimpleIntSet) SimpleIntSet
Intersect returns a new set with items that exist only in both sets.
func (SimpleIntSet) IsEmpty ¶
func (set SimpleIntSet) IsEmpty() bool
IsEmpty returns true if the set is empty.
func (SimpleIntSet) IsSequence ¶
func (set SimpleIntSet) IsSequence() bool
IsSequence returns true for lists and queues.
func (SimpleIntSet) IsSet ¶
func (set SimpleIntSet) IsSet() bool
IsSet returns false for lists or queues.
func (SimpleIntSet) IsSubset ¶
func (set SimpleIntSet) IsSubset(other SimpleIntSet) bool
IsSubset determines whether every item in the other set is in this set, returning true if so.
func (SimpleIntSet) IsSuperset ¶
func (set SimpleIntSet) IsSuperset(other SimpleIntSet) bool
IsSuperset determines whether every item of this set is in the other set, returning true if so.
func (SimpleIntSet) Map ¶
func (set SimpleIntSet) Map(f func(int) int) SimpleIntSet
Map returns a new SimpleIntSet 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 (SimpleIntSet) MapToInt64 ¶
func (set SimpleIntSet) MapToInt64(f func(int) int64) []int64
MapToInt64 returns a new []int64 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 (SimpleIntSet) MapToString ¶
func (set SimpleIntSet) MapToString(f func(int) string) []string
MapToString returns a new []string by transforming every element with function f. The resulting slice is the same size as the set. 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 (SimpleIntSet) MarshalJSON ¶
func (set SimpleIntSet) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this set type.
func (SimpleIntSet) Max ¶
func (set SimpleIntSet) Max() int
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (SimpleIntSet) MaxBy ¶
func (set SimpleIntSet) MaxBy(less func(int, int) bool) int
MaxBy returns an element of SimpleIntSet 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 (SimpleIntSet) Min ¶
func (set SimpleIntSet) Min() int
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (SimpleIntSet) MinBy ¶
func (set SimpleIntSet) MinBy(less func(int, int) bool) int
MinBy returns an element of SimpleIntSet 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 (SimpleIntSet) MkString ¶
func (set SimpleIntSet) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (SimpleIntSet) MkString3 ¶
func (set SimpleIntSet) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (SimpleIntSet) NonEmpty ¶
func (set SimpleIntSet) NonEmpty() bool
NonEmpty returns true if the set is not empty.
func (SimpleIntSet) Partition ¶
func (set SimpleIntSet) Partition(p func(int) bool) (SimpleIntSet, SimpleIntSet)
Partition returns two new SimpleIntSets 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 (SimpleIntSet) Remove ¶
func (set SimpleIntSet) Remove(i int)
Remove a single item from the set.
func (SimpleIntSet) Send ¶
func (set SimpleIntSet) Send() <-chan int
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed
func (SimpleIntSet) Size ¶
func (set SimpleIntSet) Size() int
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (SimpleIntSet) String ¶
func (set SimpleIntSet) String() string
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (SimpleIntSet) StringList ¶
func (set SimpleIntSet) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (SimpleIntSet) StringMap ¶
func (set SimpleIntSet) StringMap() map[string]bool
StringMap renders the set as a map of strings. The value of each item in the set becomes stringified as a key in the resulting map.
func (SimpleIntSet) Sum ¶
func (set SimpleIntSet) Sum() int
Sum returns the sum of all the elements in the set.
func (SimpleIntSet) SymmetricDifference ¶
func (set SimpleIntSet) SymmetricDifference(other SimpleIntSet) SimpleIntSet
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (SimpleIntSet) ToInterfaceSlice ¶
func (set SimpleIntSet) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.
func (SimpleIntSet) ToSet ¶
func (set SimpleIntSet) ToSet() SimpleIntSet
ToSet returns the set; this is an identity operation in this case.
func (SimpleIntSet) ToSlice ¶
func (set SimpleIntSet) ToSlice() []int
ToSlice returns the elements of the current set as a slice.
func (SimpleIntSet) Union ¶
func (set SimpleIntSet) Union(other SimpleIntSet) SimpleIntSet
Union returns a new set with all items in both sets.
func (SimpleIntSet) UnmarshalJSON ¶
func (set SimpleIntSet) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this set type.
type SimpleStringAppleMap ¶
SimpleStringAppleMap is the primary type that represents a map
func NewSimpleStringAppleMap ¶
func NewSimpleStringAppleMap(kv ...SimpleStringAppleTuple) SimpleStringAppleMap
NewSimpleStringAppleMap creates and returns a reference to a map, optionally containing some items.
func NewSimpleStringAppleMap1 ¶
func NewSimpleStringAppleMap1(k string, v Apple) SimpleStringAppleMap
NewSimpleStringAppleMap1 creates and returns a reference to a map containing one item.
func (*SimpleStringAppleMap) Clear ¶
func (mm *SimpleStringAppleMap) Clear()
Clear clears the entire map.
func (SimpleStringAppleMap) Clone ¶
func (mm SimpleStringAppleMap) Clone() SimpleStringAppleMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (SimpleStringAppleMap) ContainsAllKeys ¶
func (mm SimpleStringAppleMap) ContainsAllKeys(kk ...string) bool
ContainsAllKeys determines if the given items are all in the map.
func (SimpleStringAppleMap) ContainsKey ¶
func (mm SimpleStringAppleMap) ContainsKey(k string) bool
ContainsKey determines if a given item is already in the map.
func (SimpleStringAppleMap) DropWhere ¶
func (mm SimpleStringAppleMap) DropWhere(fn func(string, Apple) bool) SimpleStringAppleTuples
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 (SimpleStringAppleMap) Exists ¶
func (mm SimpleStringAppleMap) Exists(p func(string, Apple) 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 (SimpleStringAppleMap) Filter ¶
func (mm SimpleStringAppleMap) Filter(p func(string, Apple) bool) SimpleStringAppleMap
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 (SimpleStringAppleMap) Find ¶
func (mm SimpleStringAppleMap) Find(p func(string, Apple) bool) (SimpleStringAppleTuple, bool)
Find returns the first Apple that returns true for the predicate p. False is returned if none match. The original map is not modified.
func (SimpleStringAppleMap) FlatMap ¶
func (mm SimpleStringAppleMap) FlatMap(f func(string, Apple) []SimpleStringAppleTuple) SimpleStringAppleMap
FlatMap returns a new SimpleAppleMap 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 (SimpleStringAppleMap) Forall ¶
func (mm SimpleStringAppleMap) Forall(p func(string, Apple) 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 (SimpleStringAppleMap) Foreach ¶
func (mm SimpleStringAppleMap) Foreach(f func(string, Apple))
Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.
func (SimpleStringAppleMap) Get ¶
func (mm SimpleStringAppleMap) Get(k string) (Apple, bool)
Get returns one of the items in the map, if present.
func (SimpleStringAppleMap) IsEmpty ¶
func (mm SimpleStringAppleMap) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (SimpleStringAppleMap) Keys ¶
func (mm SimpleStringAppleMap) Keys() []string
Keys returns the keys of the current map as a slice.
func (SimpleStringAppleMap) Map ¶
func (mm SimpleStringAppleMap) Map(f func(string, Apple) (string, Apple)) SimpleStringAppleMap
Map returns a new SimpleAppleMap 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 (SimpleStringAppleMap) MkString ¶
func (mm SimpleStringAppleMap) MkString(sep string) string
MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.
func (SimpleStringAppleMap) MkString4 ¶ added in v3.7.0
func (mm SimpleStringAppleMap) MkString4(before, between, after, equals string) string
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (SimpleStringAppleMap) NonEmpty ¶
func (mm SimpleStringAppleMap) NonEmpty() bool
NonEmpty returns true if the map is not empty.
func (SimpleStringAppleMap) OrderedSlice ¶ added in v3.6.0
func (mm SimpleStringAppleMap) OrderedSlice(keys []string) SimpleStringAppleTuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (SimpleStringAppleMap) Partition ¶
func (mm SimpleStringAppleMap) Partition(p func(string, Apple) bool) (matching SimpleStringAppleMap, others SimpleStringAppleMap)
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 (SimpleStringAppleMap) Pop ¶
func (mm SimpleStringAppleMap) Pop(k string) (Apple, bool)
Pop removes a single item from the map, returning the value present prior to removal.
func (SimpleStringAppleMap) Put ¶
func (mm SimpleStringAppleMap) Put(k string, v Apple) bool
Put adds an item to the current map, replacing any prior value.
func (SimpleStringAppleMap) Remove ¶
func (mm SimpleStringAppleMap) Remove(k string)
Remove a single item from the map.
func (SimpleStringAppleMap) Size ¶
func (mm SimpleStringAppleMap) Size() int
Size returns how many items are currently in the map. This is a synonym for Len.
func (SimpleStringAppleMap) String ¶
func (mm SimpleStringAppleMap) String() string
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (SimpleStringAppleMap) ToSlice ¶
func (mm SimpleStringAppleMap) ToSlice() SimpleStringAppleTuples
ToSlice returns the key/value pairs as a slice.
func (SimpleStringAppleMap) Values ¶
func (mm SimpleStringAppleMap) Values() []Apple
Values returns the values of the current map as a slice.
type SimpleStringAppleTuple ¶
SimpleStringAppleTuple represents a key/value pair.
func (SimpleStringAppleTuple) MarshalJSON ¶ added in v3.6.0
func (t SimpleStringAppleTuple) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding.Marshaler interface.
func (SimpleStringAppleTuple) UnmarshalJSON ¶ added in v3.6.0
func (t SimpleStringAppleTuple) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this tuple type.
type SimpleStringAppleTuples ¶
type SimpleStringAppleTuples []SimpleStringAppleTuple
SimpleStringAppleTuples can be used as a builder for unmodifiable maps.
func SimpleStringAppleZip ¶
func SimpleStringAppleZip(keys ...string) SimpleStringAppleTuples
SimpleStringAppleZip 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 NewSimpleStringAppleMap constructor function.
func (SimpleStringAppleTuples) Append1 ¶
func (ts SimpleStringAppleTuples) Append1(k string, v Apple) SimpleStringAppleTuples
Append1 adds one item.
func (SimpleStringAppleTuples) Append2 ¶
func (ts SimpleStringAppleTuples) Append2(k1 string, v1 Apple, k2 string, v2 Apple) SimpleStringAppleTuples
Append2 adds two items.
func (SimpleStringAppleTuples) Append3 ¶
func (ts SimpleStringAppleTuples) Append3(k1 string, v1 Apple, k2 string, v2 Apple, k3 string, v3 Apple) SimpleStringAppleTuples
Append3 adds three items.
func (SimpleStringAppleTuples) MkString ¶ added in v3.6.0
func (ts SimpleStringAppleTuples) MkString(sep string) string
MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.
func (SimpleStringAppleTuples) MkString4 ¶ added in v3.7.0
func (ts SimpleStringAppleTuples) MkString4(before, between, after, equals string) string
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (SimpleStringAppleTuples) String ¶ added in v3.6.0
func (ts SimpleStringAppleTuples) String() string
func (SimpleStringAppleTuples) ToMap ¶ added in v3.6.0
func (ts SimpleStringAppleTuples) ToMap() SimpleStringAppleMap
ToMap converts the tuples to a map.
func (SimpleStringAppleTuples) Values ¶
func (ts SimpleStringAppleTuples) Values(values ...Apple) SimpleStringAppleTuples
Values sets the values in a tuple slice. Use this with SimpleStringAppleZip.
type SimpleStringList ¶ added in v3.5.4
type SimpleStringList []string
SimpleStringList 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 BuildSimpleStringListFromChan ¶ added in v3.5.4
func BuildSimpleStringListFromChan(source <-chan string) SimpleStringList
BuildSimpleStringListFromChan constructs a new SimpleStringList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertSimpleStringList ¶ added in v3.5.4
func ConvertSimpleStringList(values ...interface{}) (SimpleStringList, bool)
ConvertSimpleStringList 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 MakeSimpleStringList ¶ added in v3.5.4
func MakeSimpleStringList(length, capacity int) SimpleStringList
MakeSimpleStringList makes an empty list with both length and capacity initialised.
func NewSimpleStringList ¶ added in v3.5.4
func NewSimpleStringList(values ...string) SimpleStringList
NewSimpleStringList constructs a new list containing the supplied values, if any.
func (SimpleStringList) Clone ¶ added in v3.5.4
func (list SimpleStringList) Clone() SimpleStringList
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (SimpleStringList) Contains ¶ added in v3.5.4
func (list SimpleStringList) Contains(v string) bool
Contains determines whether a given item is already in the list, returning true if so.
func (SimpleStringList) ContainsAll ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) CountBy ¶ added in v3.5.4
func (list SimpleStringList) CountBy(p func(string) bool) (result int)
CountBy gives the number elements of SimpleStringList that return true for the predicate p.
func (SimpleStringList) DistinctBy ¶ added in v3.5.4
func (list SimpleStringList) DistinctBy(equal func(string, string) bool) SimpleStringList
DistinctBy returns a new SimpleStringList whose elements are unique, where equality is defined by the equal function.
func (SimpleStringList) DoReverse ¶ added in v3.5.4
func (list SimpleStringList) DoReverse() SimpleStringList
DoReverse alters a SimpleStringList 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 (SimpleStringList) DoShuffle ¶ added in v3.5.4
func (list SimpleStringList) DoShuffle() SimpleStringList
DoShuffle returns a shuffled SimpleStringList, using a version of the Fisher-Yates shuffle.
The list is modified and the modified list is returned.
func (SimpleStringList) Drop ¶ added in v3.5.4
func (list SimpleStringList) Drop(n int) SimpleStringList
Drop returns a slice of SimpleStringList 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 (SimpleStringList) DropLast ¶ added in v3.5.4
func (list SimpleStringList) DropLast(n int) SimpleStringList
DropLast returns a slice of SimpleStringList 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 (SimpleStringList) DropWhile ¶ added in v3.5.4
func (list SimpleStringList) DropWhile(p func(string) bool) SimpleStringList
DropWhile returns a new SimpleStringList 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 (SimpleStringList) Equals ¶ added in v3.5.4
func (list SimpleStringList) Equals(other SimpleStringList) 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 (SimpleStringList) Exists ¶ added in v3.5.4
func (list SimpleStringList) Exists(p func(string) bool) bool
Exists verifies that one or more elements of SimpleStringList return true for the predicate p.
func (SimpleStringList) Filter ¶ added in v3.5.4
func (list SimpleStringList) Filter(p func(string) bool) SimpleStringList
Filter returns a new SimpleStringList whose elements return true for predicate p.
The original list is not modified.
func (SimpleStringList) Find ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) FlatMap ¶ added in v3.5.4
func (list SimpleStringList) FlatMap(f func(string) []string) SimpleStringList
FlatMap returns a new SimpleStringList 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 (SimpleStringList) FlatMapToInt ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) Fold ¶ added in v3.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (SimpleStringList) Forall ¶ added in v3.5.4
func (list SimpleStringList) Forall(p func(string) bool) bool
Forall verifies that all elements of SimpleStringList return true for the predicate p.
func (SimpleStringList) Foreach ¶ added in v3.5.4
func (list SimpleStringList) Foreach(f func(string))
Foreach iterates over SimpleStringList and executes function f against each element.
func (SimpleStringList) Get ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) Head ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) HeadOption ¶ added in v3.5.4
func (list SimpleStringList) HeadOption() (string, bool)
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (SimpleStringList) IndexWhere ¶ added in v3.5.4
func (list SimpleStringList) IndexWhere(p func(string) bool) int
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (SimpleStringList) IndexWhere2 ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) Init ¶ added in v3.5.4
func (list SimpleStringList) Init() SimpleStringList
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 (SimpleStringList) IsEmpty ¶ added in v3.5.4
func (list SimpleStringList) IsEmpty() bool
IsEmpty tests whether SimpleStringList is empty.
func (SimpleStringList) IsSequence ¶ added in v3.5.4
func (list SimpleStringList) IsSequence() bool
IsSequence returns true for lists and queues.
func (SimpleStringList) IsSet ¶ added in v3.5.4
func (list SimpleStringList) IsSet() bool
IsSet returns false for lists or queues.
func (SimpleStringList) Last ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) LastIndexWhere ¶ added in v3.5.4
func (list SimpleStringList) LastIndexWhere(p func(string) bool) int
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (SimpleStringList) LastIndexWhere2 ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) LastOption ¶ added in v3.5.4
func (list SimpleStringList) LastOption() (string, bool)
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (SimpleStringList) Len ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) Map ¶ added in v3.5.4
func (list SimpleStringList) Map(f func(string) string) SimpleStringList
Map returns a new SimpleStringList 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 (SimpleStringList) MapToInt ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) Max ¶ added in v3.5.4
func (list SimpleStringList) Max() (result string)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (SimpleStringList) MaxBy ¶ added in v3.5.4
func (list SimpleStringList) MaxBy(less func(string, string) bool) string
MaxBy returns an element of SimpleStringList 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 (SimpleStringList) Min ¶ added in v3.5.4
func (list SimpleStringList) Min() string
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (SimpleStringList) MinBy ¶ added in v3.5.4
func (list SimpleStringList) MinBy(less func(string, string) bool) string
MinBy returns an element of SimpleStringList 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 (SimpleStringList) MkString ¶ added in v3.5.4
func (list SimpleStringList) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (SimpleStringList) MkString3 ¶ added in v3.5.4
func (list SimpleStringList) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (SimpleStringList) NonEmpty ¶ added in v3.5.4
func (list SimpleStringList) NonEmpty() bool
NonEmpty tests whether SimpleStringList is empty.
func (SimpleStringList) Partition ¶ added in v3.5.4
func (list SimpleStringList) Partition(p func(string) bool) (SimpleStringList, SimpleStringList)
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 (SimpleStringList) Reverse ¶ added in v3.5.4
func (list SimpleStringList) Reverse() SimpleStringList
Reverse returns a copy of SimpleStringList with all elements in the reverse order.
The original list is not modified.
func (SimpleStringList) Send ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) Shuffle ¶ added in v3.5.4
func (list SimpleStringList) Shuffle() SimpleStringList
Shuffle returns a shuffled copy of SimpleStringList, using a version of the Fisher-Yates shuffle.
The original list is not modified.
func (SimpleStringList) Size ¶ added in v3.5.4
func (list SimpleStringList) Size() int
Size returns the number of items in the list - an alias of Len().
func (SimpleStringList) SortBy ¶ added in v3.5.4
func (list SimpleStringList) SortBy(less func(i, j string) bool) SimpleStringList
SortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned.
func (SimpleStringList) Sorted ¶ added in v3.5.4
func (list SimpleStringList) Sorted() SimpleStringList
Sorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (SimpleStringList) StableSortBy ¶ added in v3.5.4
func (list SimpleStringList) StableSortBy(less func(i, j string) bool) SimpleStringList
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 (SimpleStringList) StableSorted ¶ added in v3.5.4
func (list SimpleStringList) StableSorted() SimpleStringList
StableSorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (SimpleStringList) String ¶ added in v3.5.4
func (list SimpleStringList) String() string
String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.
func (SimpleStringList) StringList ¶ added in v3.5.4
func (list SimpleStringList) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (SimpleStringList) Swap ¶ added in v3.5.4
func (list SimpleStringList) 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 (SimpleStringList) Tail ¶ added in v3.5.4
func (list SimpleStringList) Tail() SimpleStringList
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 (SimpleStringList) Take ¶ added in v3.5.4
func (list SimpleStringList) Take(n int) SimpleStringList
Take returns a slice of SimpleStringList 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 (SimpleStringList) TakeLast ¶ added in v3.5.4
func (list SimpleStringList) TakeLast(n int) SimpleStringList
TakeLast returns a slice of SimpleStringList 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 (SimpleStringList) TakeWhile ¶ added in v3.5.4
func (list SimpleStringList) TakeWhile(p func(string) bool) SimpleStringList
TakeWhile returns a new SimpleStringList 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 (SimpleStringList) ToInterfaceSlice ¶ added in v3.5.4
func (list SimpleStringList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (SimpleStringList) ToList ¶ added in v3.5.4
func (list SimpleStringList) ToList() SimpleStringList
ToList returns the elements of the list as a list, which is an identity operation in this case.
func (SimpleStringList) ToSlice ¶ added in v3.5.4
func (list SimpleStringList) 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 StringAppleMap ¶
type StringAppleMap struct {
// contains filtered or unexported fields
}
StringAppleMap is the primary type that represents a thread-safe map
func NewStringAppleMap ¶
func NewStringAppleMap(kv ...StringAppleTuple) *StringAppleMap
NewStringAppleMap creates and returns a reference to a map, optionally containing some items.
func NewStringAppleMap1 ¶
func NewStringAppleMap1(k string, v Apple) *StringAppleMap
NewStringAppleMap1 creates and returns a reference to a map containing one item.
func (*StringAppleMap) Clone ¶
func (mm *StringAppleMap) Clone() *StringAppleMap
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (*StringAppleMap) ContainsAllKeys ¶
func (mm *StringAppleMap) ContainsAllKeys(kk ...string) bool
ContainsAllKeys determines if the given items are all in the map.
func (*StringAppleMap) ContainsKey ¶
func (mm *StringAppleMap) ContainsKey(k string) bool
ContainsKey determines if a given item is already in the map.
func (*StringAppleMap) DropWhere ¶
func (mm *StringAppleMap) DropWhere(fn func(string, Apple) bool) StringAppleTuples
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 (*StringAppleMap) Equals ¶ added in v3.6.0
func (mm *StringAppleMap) Equals(other *StringAppleMap) 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 (*StringAppleMap) Exists ¶
func (mm *StringAppleMap) Exists(p func(string, Apple) 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 (*StringAppleMap) Filter ¶
func (mm *StringAppleMap) Filter(p func(string, Apple) bool) *StringAppleMap
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 (*StringAppleMap) Find ¶
func (mm *StringAppleMap) Find(p func(string, Apple) bool) (StringAppleTuple, bool)
Find returns the first Apple that returns true for the predicate p. False is returned if none match. The original map is not modified.
func (*StringAppleMap) FlatMap ¶
func (mm *StringAppleMap) FlatMap(f func(string, Apple) []StringAppleTuple) *StringAppleMap
FlatMap returns a new AppleMap 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 (*StringAppleMap) Forall ¶
func (mm *StringAppleMap) Forall(p func(string, Apple) 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 (*StringAppleMap) Foreach ¶
func (mm *StringAppleMap) Foreach(f func(string, Apple))
Foreach applies the function f to every element in the map. The function can safely alter the values via side-effects.
func (*StringAppleMap) Get ¶
func (mm *StringAppleMap) Get(k string) (Apple, bool)
Get returns one of the items in the map, if present.
func (*StringAppleMap) GobDecode ¶
func (mm *StringAppleMap) GobDecode(b []byte) error
GobDecode implements 'gob' decoding for this map type. You must register Apple with the 'gob' package before this method is used.
func (*StringAppleMap) GobEncode ¶
func (mm *StringAppleMap) GobEncode() ([]byte, error)
GobEncode implements 'gob' encoding for this map type. You must register Apple with the 'gob' package before this method is used.
func (*StringAppleMap) IsEmpty ¶
func (mm *StringAppleMap) IsEmpty() bool
IsEmpty returns true if the map is empty.
func (*StringAppleMap) Keys ¶
func (mm *StringAppleMap) Keys() []string
Keys returns the keys of the current map as a slice.
func (*StringAppleMap) Map ¶
func (mm *StringAppleMap) Map(f func(string, Apple) (string, Apple)) *StringAppleMap
Map returns a new AppleMap 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 (*StringAppleMap) MarshalJSON ¶ added in v3.6.0
func (mm *StringAppleMap) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this map type.
func (*StringAppleMap) MkString ¶ added in v3.6.0
func (mm *StringAppleMap) MkString(sep string) string
MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.
func (*StringAppleMap) MkString4 ¶ added in v3.7.0
func (mm *StringAppleMap) MkString4(before, between, after, equals string) string
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (*StringAppleMap) NonEmpty ¶
func (mm *StringAppleMap) NonEmpty() bool
NonEmpty returns true if the map is not empty.
func (*StringAppleMap) OrderedSlice ¶ added in v3.6.0
func (mm *StringAppleMap) OrderedSlice(keys []string) StringAppleTuples
OrderedSlice returns the key/value pairs as a slice in the order specified by keys.
func (*StringAppleMap) Partition ¶
func (mm *StringAppleMap) Partition(p func(string, Apple) bool) (matching *StringAppleMap, others *StringAppleMap)
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 (*StringAppleMap) Pop ¶
func (mm *StringAppleMap) Pop(k string) (Apple, bool)
Pop removes a single item from the map, returning the value present prior to removal. The boolean result is true only if the key had been present.
func (*StringAppleMap) Put ¶
func (mm *StringAppleMap) Put(k string, v Apple) bool
Put adds an item to the current map, replacing any prior value.
func (*StringAppleMap) Remove ¶
func (mm *StringAppleMap) Remove(k string)
Remove a single item from the map.
func (*StringAppleMap) Size ¶
func (mm *StringAppleMap) Size() int
Size returns how many items are currently in the map. This is a synonym for Len.
func (*StringAppleMap) String ¶ added in v3.6.0
func (mm *StringAppleMap) String() string
String implements the Stringer interface to render the set as a comma-separated string enclosed in square brackets.
func (*StringAppleMap) ToSlice ¶
func (mm *StringAppleMap) ToSlice() StringAppleTuples
ToSlice returns the key/value pairs as a slice
func (*StringAppleMap) UnmarshalJSON ¶ added in v3.6.0
func (mm *StringAppleMap) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this map type.
func (*StringAppleMap) Values ¶
func (mm *StringAppleMap) Values() []Apple
Values returns the values of the current map as a slice.
type StringAppleTuple ¶
StringAppleTuple represents a key/value pair.
func (StringAppleTuple) MarshalJSON ¶ added in v3.6.0
func (t StringAppleTuple) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding.Marshaler interface.
func (StringAppleTuple) UnmarshalJSON ¶ added in v3.6.0
func (t StringAppleTuple) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this tuple type.
type StringAppleTuples ¶
type StringAppleTuples []StringAppleTuple
StringAppleTuples can be used as a builder for unmodifiable maps.
func StringAppleZip ¶
func StringAppleZip(keys ...string) StringAppleTuples
StringAppleZip 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 NewStringAppleMap constructor function.
func (StringAppleTuples) Append1 ¶
func (ts StringAppleTuples) Append1(k string, v Apple) StringAppleTuples
Append1 adds one item.
func (StringAppleTuples) Append2 ¶
func (ts StringAppleTuples) Append2(k1 string, v1 Apple, k2 string, v2 Apple) StringAppleTuples
Append2 adds two items.
func (StringAppleTuples) Append3 ¶
func (ts StringAppleTuples) Append3(k1 string, v1 Apple, k2 string, v2 Apple, k3 string, v3 Apple) StringAppleTuples
Append3 adds three items.
func (StringAppleTuples) MkString ¶ added in v3.6.0
func (ts StringAppleTuples) MkString(sep string) string
MkString concatenates the map key/values as a string using a supplied separator. No enclosing marks are added.
func (StringAppleTuples) MkString4 ¶ added in v3.7.0
func (ts StringAppleTuples) MkString4(before, between, after, equals string) string
MkString4 concatenates the map key/values as a string, using the prefix, separator and suffix supplied.
func (StringAppleTuples) String ¶ added in v3.6.0
func (ts StringAppleTuples) String() string
func (StringAppleTuples) ToMap ¶ added in v3.6.0
func (ts StringAppleTuples) ToMap() *StringAppleMap
ToMap converts the tuples to a map.
func (StringAppleTuples) Values ¶
func (ts StringAppleTuples) Values(values ...Apple) StringAppleTuples
Values sets the values in a tuple slice. Use this with StringAppleZip.
type StringList ¶ added in v3.5.4
type StringList struct {
// contains filtered or unexported fields
}
StringList contains a slice of type string. It encapsulates the slice and provides methods to access or mutate it.
List values follow a similar pattern to Scala Lists and LinearSeqs in particular. For comparison with Scala, see e.g. http://www.scala-lang.org/api/2.11.7/#scala.collection.LinearSeq
func BuildStringListFromChan ¶ added in v3.5.4
func BuildStringListFromChan(source <-chan string) *StringList
BuildStringListFromChan constructs a new StringList from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertStringList ¶ added in v3.5.4
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 ¶ added in v3.5.4
func MakeStringList(length, capacity int) *StringList
MakeStringList makes an empty list with both length and capacity initialised.
func NewStringList ¶ added in v3.5.4
func NewStringList(values ...string) *StringList
NewStringList constructs a new list containing the supplied values, if any.
func (*StringList) Add ¶ added in v3.5.4
func (list *StringList) Add(more ...string)
Add adds items to the current list. This is a synonym for Append.
func (*StringList) Append ¶ added in v3.5.4
func (list *StringList) Append(more ...string) *StringList
Append adds items to the current list. If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned.
func (*StringList) Clear ¶ added in v3.5.4
func (list *StringList) Clear()
Clear the entire collection.
func (*StringList) Clone ¶ added in v3.5.4
func (list *StringList) Clone() *StringList
Clone returns a shallow copy of the list. It does not clone the underlying elements.
func (*StringList) Contains ¶ added in v3.5.4
func (list *StringList) Contains(v string) bool
Contains determines whether a given item is already in the list, returning true if so.
func (*StringList) ContainsAll ¶ added in v3.5.4
func (list *StringList) ContainsAll(i ...string) bool
ContainsAll determines whether the given items are all in the list, returning true if so. This is potentially a slow method and should only be used rarely.
func (*StringList) CountBy ¶ added in v3.5.4
func (list *StringList) CountBy(p func(string) bool) (result int)
CountBy gives the number elements of StringList that return true for the predicate p.
func (*StringList) DistinctBy ¶ added in v3.5.4
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) DoDeleteAt ¶ added in v3.5.4
func (list *StringList) DoDeleteAt(index, n int) *StringList
DoDeleteAt modifies a StringList by deleting n elements from a given index.
The list is modified and the modified list is returned. Panics if the index is out of range or n is large enough to take the index out of range.
func (*StringList) DoDeleteFirst ¶ added in v3.5.4
func (list *StringList) DoDeleteFirst(n int) *StringList
DoDeleteFirst modifies a StringList by deleting n elements from the start of the list.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if n is large enough to take the index out of range.
func (*StringList) DoDeleteLast ¶ added in v3.5.4
func (list *StringList) DoDeleteLast(n int) *StringList
DoDeleteLast modifies a StringList by deleting n elements from the end of the list.
The list is modified and the modified list is returned. Panics if n is large enough to take the index out of range.
func (*StringList) DoInsertAt ¶ added in v3.5.4
func (list *StringList) DoInsertAt(index int, more ...string) *StringList
DoInsertAt modifies a StringList by inserting elements at a given index. This is a generalised version of Append.
If the list is nil, a new list is allocated and returned. Otherwise the modified list is returned. Panics if the index is out of range.
func (*StringList) DoKeepWhere ¶ added in v3.5.4
func (list *StringList) DoKeepWhere(p func(string) bool) *StringList
DoKeepWhere modifies a StringList by retaining only those elements that match the predicate p. This is very similar to Filter but alters the list in place.
The list is modified and the modified list is returned.
func (*StringList) DoReverse ¶ added in v3.5.4
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 ¶ added in v3.5.4
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 ¶ added in v3.5.4
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 ¶ added in v3.5.4
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 ¶ added in v3.5.4
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 ¶ added in v3.5.4
func (list *StringList) Equals(other *StringList) bool
Equals determines if two lists are equal to each other. If they both are the same size and have the same items in the same order, they are considered equal. Order of items is not relevent for sets to be equal. Nil lists are considered to be empty.
func (*StringList) Exists ¶ added in v3.5.4
func (list *StringList) Exists(p func(string) bool) bool
Exists verifies that one or more elements of StringList return true for the predicate p.
func (*StringList) Filter ¶ added in v3.5.4
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. See also DoKeepWhere (which does modify the original list).
func (*StringList) Find ¶ added in v3.5.4
func (list *StringList) Find(p func(string) bool) (string, bool)
Find returns the first string that returns true for predicate p. False is returned if none match.
func (*StringList) FlatMap ¶ added in v3.5.4
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 v3.5.4
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 v3.9.0
Fold aggregates all the values in the list using a supplied function, starting from some initial value.
func (*StringList) Forall ¶ added in v3.5.4
func (list *StringList) Forall(p func(string) bool) bool
Forall verifies that all elements of StringList return true for the predicate p.
func (*StringList) Foreach ¶ added in v3.5.4
func (list *StringList) Foreach(f func(string))
Foreach iterates over StringList and executes function f against each element. The function can safely alter the values via side-effects.
func (*StringList) Get ¶ added in v3.5.4
func (list *StringList) Get(i int) string
Get gets the specified element in the list. Panics if the index is out of range or the list is nil.
func (*StringList) Head ¶ added in v3.5.4
func (list *StringList) Head() string
Head gets the first element in the list. Head plus Tail include the whole list. Head is the opposite of Last. Panics if list is empty or nil.
func (*StringList) HeadOption ¶ added in v3.5.4
func (list *StringList) HeadOption() (string, bool)
HeadOption gets the first element in the list, if possible. Otherwise returns the zero value.
func (*StringList) IndexWhere ¶ added in v3.5.4
func (list *StringList) IndexWhere(p func(string) bool) int
IndexWhere finds the index of the first element satisfying predicate p. If none exists, -1 is returned.
func (*StringList) IndexWhere2 ¶ added in v3.5.4
func (list *StringList) IndexWhere2(p func(string) bool, from int) int
IndexWhere2 finds the index of the first element satisfying predicate p at or after some start index. If none exists, -1 is returned.
func (*StringList) Init ¶ added in v3.5.4
func (list *StringList) Init() *StringList
Init gets everything except the last. Init plus Last include the whole list. Init is the opposite of Tail. Panics if list is empty or nil.
func (*StringList) IsEmpty ¶ added in v3.5.4
func (list *StringList) IsEmpty() bool
IsEmpty tests whether StringList is empty.
func (*StringList) IsSequence ¶ added in v3.5.4
func (list *StringList) IsSequence() bool
IsSequence returns true for lists and queues.
func (*StringList) IsSet ¶ added in v3.5.4
func (list *StringList) IsSet() bool
IsSet returns false for lists or queues.
func (*StringList) Last ¶ added in v3.5.4
func (list *StringList) Last() string
Last gets the last element in the list. Init plus Last include the whole list. Last is the opposite of Head. Panics if list is empty or nil.
func (*StringList) LastIndexWhere ¶ added in v3.5.4
func (list *StringList) LastIndexWhere(p func(string) bool) int
LastIndexWhere finds the index of the last element satisfying predicate p. If none exists, -1 is returned.
func (*StringList) LastIndexWhere2 ¶ added in v3.5.4
func (list *StringList) LastIndexWhere2(p func(string) bool, before int) int
LastIndexWhere2 finds the index of the last element satisfying predicate p at or before some start index. If none exists, -1 is returned.
func (*StringList) LastOption ¶ added in v3.5.4
func (list *StringList) LastOption() (string, bool)
LastOption gets the last element in the list, if possible. Otherwise returns the zero value.
func (*StringList) Len ¶ added in v3.5.4
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 ¶ added in v3.5.4
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 v3.5.4
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) MarshalJSON ¶ added in v3.5.4
func (list StringList) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON encoding for this list type.
func (*StringList) Max ¶ added in v3.5.4
func (list *StringList) Max() (result string)
Max returns the first element containing the maximum value, when compared to other elements. Panics if the collection is empty.
func (*StringList) MaxBy ¶ added in v3.5.4
func (list *StringList) MaxBy(less func(string, string) bool) string
MaxBy returns an element of StringList containing the maximum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally maximal, the first such element is returned. Panics if there are no elements.
func (*StringList) Min ¶ added in v3.5.4
func (list *StringList) Min() string
Min returns the first element containing the minimum value, when compared to other elements. Panics if the collection is empty.
func (*StringList) MinBy ¶ added in v3.5.4
func (list *StringList) MinBy(less func(string, string) bool) string
MinBy returns an element of StringList containing the minimum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally minimal, the first such element is returned. Panics if there are no elements.
func (*StringList) MkString ¶ added in v3.5.4
func (list *StringList) MkString(sep string) string
MkString concatenates the values as a string using a supplied separator. No enclosing marks are added.
func (*StringList) MkString3 ¶ added in v3.5.4
func (list *StringList) MkString3(before, between, after string) string
MkString3 concatenates the values as a string, using the prefix, separator and suffix supplied.
func (*StringList) NonEmpty ¶ added in v3.5.4
func (list *StringList) NonEmpty() bool
NonEmpty tests whether StringList is empty.
func (*StringList) Partition ¶ added in v3.5.4
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 ¶ added in v3.5.4
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 ¶ added in v3.5.4
func (list *StringList) Send() <-chan string
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed. The channel will be closed when all the elements have been sent.
func (*StringList) Shuffle ¶ added in v3.5.4
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 ¶ added in v3.5.4
func (list *StringList) Size() int
Size returns the number of items in the list - an alias of Len().
func (*StringList) SortBy ¶ added in v3.5.4
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 v3.5.4
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 ¶ added in v3.5.4
func (list *StringList) StableSortBy(less func(i, j string) bool) *StringList
StableSortBy alters the list so that the elements are sorted by a specified ordering. Sorting happens in-place; the modified list is returned. The algorithm keeps the original order of equal elements.
func (*StringList) StableSorted ¶ added in v3.5.4
func (list *StringList) StableSorted() *StringList
StableSorted alters the list so that the elements are sorted by their natural ordering. Sorting happens in-place; the modified list is returned.
func (*StringList) String ¶ added in v3.5.4
func (list *StringList) String() string
String implements the Stringer interface to render the list as a comma-separated string enclosed in square brackets.
func (*StringList) StringList ¶ added in v3.5.4
func (list *StringList) StringList() []string
StringList gets a list of strings that depicts all the elements.
func (*StringList) Swap ¶ added in v3.5.4
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 ¶ added in v3.5.4
func (list *StringList) Tail() *StringList
Tail gets everything except the head. Head plus Tail include the whole list. Tail is the opposite of Init. Panics if list is empty or nil.
func (*StringList) Take ¶ added in v3.5.4
func (list *StringList) Take(n int) *StringList
Take returns a slice of StringList containing the leading n elements of the source list. If n is greater than or equal to the size of the list, the whole original list is returned.
func (*StringList) TakeLast ¶ added in v3.5.4
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 ¶ added in v3.5.4
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 ¶ added in v3.5.4
func (list *StringList) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current list as a slice of arbitrary type.
func (*StringList) ToList ¶ added in v3.5.4
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) ToSlice ¶ added in v3.5.4
func (list *StringList) ToSlice() []string
ToSlice returns the elements of the current list as a slice.
func (*StringList) UnmarshalJSON ¶ added in v3.5.4
func (list *StringList) UnmarshalJSON(b []byte) error
UnmarshalJSON implements JSON decoding for this list type.
Source Files
¶
- apple_collection.go
- apple_int_mapto.go
- apple_list.go
- apple_plumbing.go
- apple_queue.go
- apple_set.go
- email_stringy.go
- fast_apple_collection.go
- fast_apple_list.go
- fast_apple_queue.go
- fast_apple_set.go
- fast_int_collection.go
- fast_int_int_map.go
- fast_int_list.go
- fast_int_queue.go
- fast_int_set.go
- fast_string_apple_map.go
- fast_string_list.go
- gen.go
- immutable_apple_collection.go
- immutable_apple_list.go
- immutable_apple_set.go
- immutable_int_collection.go
- immutable_int_int_map.go
- immutable_int_list.go
- immutable_int_set.go
- immutable_string_apple_map.go
- immutable_string_list.go
- int_collection.go
- int_int_map.go
- int_list.go
- int_queue.go
- int_set.go
- simple_apple_list.go
- simple_apple_set.go
- simple_int_int_map.go
- simple_int_list.go
- simple_int_set.go
- simple_string_apple_map.go
- simple_string_list.go
- string_apple_map.go
- string_list.go