@@ -14,6 +14,8 @@ import (
1414// since iter.SliceElem([]int{2, 3, 1})) yields 2 3 1
1515// then Order(iter.SliceElem([]int{2, 3, 1})) will yield 1 2 3
1616// and Order(iter.SliceElem([]int{2, 3, 1}), true) will yield 3 2 1.
17+ //
18+ // be careful, if this function is used on iterators that has massive amount of data, it might consume a lot of memory.
1719func Order [TIter SeqX [T ], T cmp.Ordered ](
1820 iterator TIter ,
1921 desc ... bool ,
@@ -39,6 +41,8 @@ func Order[TIter SeqX[T], T cmp.Ordered](
3941// since iter.Map(map[string]int{"bob":2, "eve":3, "alice":1}) yields the 2-tuples in arbitrary order
4042// then OrderV1(iter.Map(map[string]int{"bob":2, "eve":3, "alice":1})) will yield (alice, 1) (bob 2) (eve 3)
4143// and OrderV1(iter.Map(map[string]int{"bob":2, "eve":3, "alice":1}), true) will yield (eve 3) (bob 2) (alice, 1).
44+ //
45+ // be careful, if this function is used on iterators that has massive amount of data, it might consume a lot of memory.
4246func OrderV1 [TIter Seq2X [T1 , T2 ], T1 cmp.Ordered , T2 any ](
4347 iterator TIter ,
4448 desc ... bool ,
@@ -59,6 +63,7 @@ func OrderV1[TIter Seq2X[T1, T2], T1 cmp.Ordered, T2 any](
5963}
6064
6165// OrderV2 is like OrderV1, but it sorts by the second element of the 2-tuples.
66+ // be careful, if this function is used on iterators that has massive amount of data, it might consume a lot of memory.
6267func OrderV2 [TIter Seq2X [T1 , T2 ], T1 any , T2 cmp.Ordered ](
6368 iterator TIter ,
6469 desc ... bool ,
@@ -78,6 +83,7 @@ func OrderV2[TIter Seq2X[T1, T2], T1 any, T2 cmp.Ordered](
7883}
7984
8085// OrderBy accepts a comparison function and returns a new iterator that yields elements sorted by the comparison function.
86+ // be careful, if this function is used on iterators that has massive amount of data, it might consume a lot of memory.
8187func OrderBy [TIter SeqX [T ], T any ](
8288 iterator TIter ,
8389 cmp func (T , T ) int ,
@@ -86,6 +92,7 @@ func OrderBy[TIter SeqX[T], T any](
8692}
8793
8894// Order2By is the Iterator2 version of OrderBy.
95+ // be careful, if this function is used on iterators that has massive amount of data, it might consume a lot of memory.
8996func Order2By [TIter Seq2X [T1 , T2 ], T1 , T2 any ](
9097 iterator TIter ,
9198 cmp func (* Combined [T1 , T2 ], * Combined [T1 , T2 ]) int ,
@@ -94,6 +101,7 @@ func Order2By[TIter Seq2X[T1, T2], T1, T2 any](
94101}
95102
96103// StableOrderBy is like OrderBy, but it uses a stable sort algorithm.
104+ // be careful, if this function is used on iterators that has massive amount of data, it might consume a lot of memory.
97105func StableOrderBy [TIter SeqX [T ], T any ](
98106 iterator TIter ,
99107 cmp func (T , T ) int ,
@@ -102,6 +110,7 @@ func StableOrderBy[TIter SeqX[T], T any](
102110}
103111
104112// StableOrder2By is like Order2By, but it uses a stable sort algorithm.
113+ // be careful, if this function is used on iterators that has massive amount of data, it might consume a lot of memory.
105114func StableOrder2By [TIter Seq2X [T1 , T2 ], T1 , T2 any ](
106115 iterator TIter ,
107116 cmp func (* Combined [T1 , T2 ], * Combined [T1 , T2 ]) int ,
0 commit comments