-
Notifications
You must be signed in to change notification settings - Fork 1
/
ordered_enumerable.generated.go
120 lines (92 loc) · 2.72 KB
/
ordered_enumerable.generated.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// This code was generated by a tool.
package enu
import "golang.org/x/exp/constraints"
type OrderedEnumerable[T constraints.Ordered] struct {
enumerator IEnumerator[T]
}
func NewOrdered[T constraints.Ordered](e IEnumerator[T]) *OrderedEnumerable[T] {
return &OrderedEnumerable[T]{enumerator: e}
}
func (e *OrderedEnumerable[T]) Each(iteratee func(T, int)) *OrderedEnumerable[T] {
each[T](e, func(item T, index int) bool {
iteratee(item, index)
return true
})
return e
}
func (e *OrderedEnumerable[T]) ToSlice() []T {
return ToSlice[T](e)
}
func (e *OrderedEnumerable[T]) Count() int {
return Count[T](e)
}
func (e *OrderedEnumerable[T]) Filter(predicate func(T, int) bool) *OrderedEnumerable[T] {
return NewOrdered[T](Filter[T](e, predicate))
}
func (e *OrderedEnumerable[T]) Nth(nth int) (T, bool) {
return Nth[T](e, nth)
}
func (e *OrderedEnumerable[T]) Find(predicate func(T, int) bool) (T, bool) {
return Find[T](e, predicate)
}
func (e *OrderedEnumerable[T]) First() (T, bool) {
return First[T](e)
}
func (e *OrderedEnumerable[T]) Last() (T, bool) {
return Last[T](e)
}
func (e *OrderedEnumerable[T]) Reverse() *OrderedEnumerable[T] {
return NewOrdered[T](Reverse[T](e))
}
func (e *OrderedEnumerable[T]) SortBy(sorter func(i, j T) bool) *OrderedEnumerable[T] {
return NewOrdered[T](SortBy[T](e, sorter))
}
func (e *OrderedEnumerable[T]) Reject(predicate func(T, int) bool) *OrderedEnumerable[T] {
return NewOrdered[T](Reject[T](e, predicate))
}
func (e *OrderedEnumerable[T]) IsAll(predicate func(T) bool) bool {
return IsAll[T](e, predicate)
}
func (e *OrderedEnumerable[T]) IsAny(predicate func(T) bool) bool {
return IsAny[T](e, predicate)
}
func (e *OrderedEnumerable[T]) Take(num int) *OrderedEnumerable[T] {
return NewOrdered[T](Take[T](e, num))
}
func (e *OrderedEnumerable[T]) Result(out *[]T) *OrderedEnumerable[T] {
Result[T](e, out)
return e
}
func (e *OrderedEnumerable[T]) Err() error {
if p, ok := e.enumerator.(ErrorProvider); ok {
return p.Err()
}
return nil
}
func (e *OrderedEnumerable[T]) GetEnumerator() IEnumerator[T] {
return e.enumerator
}
func (e *OrderedEnumerable[T]) Min() T {
return Min[T](e)
}
func (e *OrderedEnumerable[T]) Sort() *OrderedEnumerable[T] {
return NewOrdered[T](Sort[T](e))
}
func (e *OrderedEnumerable[T]) ToMap() map[int]T {
return Reduce[T](e, func(agg map[int]T, item T, index int) map[int]T {
agg[index] = item
return agg
}, map[int]T{})
}
func (e *OrderedEnumerable[T]) Uniq() *OrderedEnumerable[T] {
return NewOrdered[T](Uniq[T](e))
}
func (e *OrderedEnumerable[T]) Contains(item T) bool {
return Contains[T](e, item)
}
func (e *OrderedEnumerable[T]) IndexOf(item T) int {
return IndexOf[T](e, item)
}
func (e *OrderedEnumerable[T]) Max() T {
return Max[T](e)
}