@@ -95,6 +95,7 @@ class StreamTest extends GroovyTestCase {
9595 assert reverseResult. get(1 ). elements. toList() == [00 , 20 , 40 , 60 , 80 ]
9696 }
9797
98+ @SuppressWarnings (" GroovyAssignabilityCheck" )
9899 void testOrderBy () {
99100 def integers = 0 .. 9
100101 def integersDescending = 9 .. 0
@@ -116,7 +117,6 @@ class StreamTest extends GroovyTestCase {
116117 .orderBy({ n -> n }, numbersComparator)
117118 .toList()
118119
119-
120120 // orderBy count()
121121 assert shuffledItems. size() ==
122122 stream(shuffledItems)
@@ -142,7 +142,6 @@ class StreamTest extends GroovyTestCase {
142142 assert stream(shuffledItems). orderByDescending({ n -> n }). toList() ==
143143 stream(shuffledItems). orderBy({ n -> n }). reverse(). toList()
144144
145-
146145 // thenBy & thenByDescending over orderBy
147146 def matrix = [[1 , 1 ], [1 , 2 ], [1 , 3 ], [2 , 1 ], [2 , 2 ], [2 , 3 ], [3 , 1 ], [3 , 2 ], [3 , 3 ]]
148147 def shuffledMatrix = []
@@ -152,53 +151,53 @@ class StreamTest extends GroovyTestCase {
152151
153152 assert [[1 , 1 ], [1 , 2 ], [1 , 3 ], [2 , 1 ], [2 , 2 ], [2 , 3 ], [3 , 1 ], [3 , 2 ], [3 , 3 ]] ==
154153 stream(shuffledMatrix)
155- .orderBy({n -> n[' 0 ' ] })
156- .thenBy({n -> n[' 1 ' ] })
154+ .orderBy({ n -> n[0 ] })
155+ .thenBy({ n -> n[1 ] })
157156 .toList()
158157
159158 assert [[1 , 3 ], [1 , 2 ], [1 , 1 ], [2 , 3 ], [2 , 2 ], [2 , 1 ], [3 , 3 ], [3 , 2 ], [3 , 1 ]] ==
160159 stream(shuffledMatrix)
161- .orderBy({n -> n[' 0 ' ] })
162- .thenByDescending({ n -> n[' 1 ' ] })
160+ .orderBy({ n -> n[0 ] })
161+ .thenByDescending({ n -> n[1 ] })
163162 .toList()
164163
165164
166165 assert [[1 , 1 ], [1 , 2 ], [1 , 3 ], [2 , 1 ], [2 , 2 ], [2 , 3 ], [3 , 1 ], [3 , 2 ], [3 , 3 ]] ==
167166 stream(shuffledMatrix)
168- .orderBy({n -> n[' 0 ' ] })
169- .thenBy({n -> n[' 1 ' ] }, numbersComparator)
167+ .orderBy({ n -> n[0 ] })
168+ .thenBy({ n -> n[1 ] }, numbersComparator)
170169 .toList()
171170
172171 assert [[1 , 3 ], [1 , 2 ], [1 , 1 ], [2 , 3 ], [2 , 2 ], [2 , 1 ], [3 , 3 ], [3 , 2 ], [3 , 1 ]] ==
173172 stream(shuffledMatrix)
174- .orderBy({n -> n[' 0 ' ] })
175- .thenByDescending({ n -> n[' 1 ' ] }, numbersComparator)
173+ .orderBy({ n -> n[0 ] })
174+ .thenByDescending({ n -> n[1 ] }, numbersComparator)
176175 .toList()
177176
178177 // thenBy & thenByDescending over orderByDescending
179178 assert [[3 , 1 ], [3 , 2 ], [3 , 3 ], [2 , 1 ], [2 , 2 ], [2 , 3 ], [1 , 1 ], [1 , 2 ], [1 , 3 ]] ==
180179 stream(shuffledMatrix)
181- .orderByDescending({n -> n[' 0 ' ] })
182- .thenBy({n -> n[' 1 ' ] })
180+ .orderByDescending({ n -> n[0 ] })
181+ .thenBy({ n -> n[1 ] })
183182 .toList()
184183
185184 assert [[3 , 3 ], [3 , 2 ], [3 , 1 ], [2 , 3 ], [2 , 2 ], [2 , 1 ], [1 , 3 ], [1 , 2 ], [1 , 1 ]] ==
186185 stream(shuffledMatrix)
187- .orderByDescending({n -> n[' 0 ' ] })
188- .thenByDescending({ n -> n[' 1 ' ] })
186+ .orderByDescending({ n -> n[0 ] })
187+ .thenByDescending({ n -> n[1 ] })
189188 .toList()
190189
191190
192191 assert [[3 , 1 ], [3 , 2 ], [3 , 3 ], [2 , 1 ], [2 , 2 ], [2 , 3 ], [1 , 1 ], [1 , 2 ], [1 , 3 ]] ==
193192 stream(shuffledMatrix)
194- .orderByDescending({n -> n[' 0 ' ] })
195- .thenBy({n -> n[' 1 ' ] }, numbersComparator)
193+ .orderByDescending({ n -> n[0 ] })
194+ .thenBy({ n -> n[1 ] }, numbersComparator)
196195 .toList()
197196
198197 assert [[3 , 3 ], [3 , 2 ], [3 , 1 ], [2 , 3 ], [2 , 2 ], [2 , 1 ], [1 , 3 ], [1 , 2 ], [1 , 1 ]] ==
199198 stream(shuffledMatrix)
200- .orderByDescending({n -> n[' 0 ' ] })
201- .thenByDescending({ n -> n[' 1 ' ] }, numbersComparator)
199+ .orderByDescending({ n -> n[0 ] })
200+ .thenByDescending({ n -> n[1 ] }, numbersComparator)
202201 .toList()
203202 }
204203
0 commit comments