Values returns the final list of distinct values collected and sorted.
()
| 102 | |
| 103 | // Values returns the final list of distinct values collected and sorted. |
| 104 | func (d *DistinctValue[T]) Values() []T { |
| 105 | d.mtx.Lock() |
| 106 | defer d.mtx.Unlock() |
| 107 | |
| 108 | ss := make([]T, 0, len(d.values)) |
| 109 | for k := range d.values { |
| 110 | ss = append(ss, k) |
| 111 | } |
| 112 | |
| 113 | return ss |
| 114 | } |
| 115 | |
| 116 | // Exceeded indicates that we have exceeded the limit |
| 117 | // can be used to stop early and to avoid collecting further values |
no outgoing calls