@@ -212,7 +212,9 @@ public void sort() {
212212// FastQSort.sort(items, 0, count - 1);
213213
214214 Arrays .parallelSort (items , 0 , count );
215+
215216 Arrays .stream (items , 0 , count ).parallel ().forEach (Entry ::clear );
217+ encounteredPrimitiveTypesForOrderSpecs .forEach (BitSet ::clear );
216218 }
217219
218220 @ Override
@@ -408,7 +410,6 @@ public void setContextSequence(@Nullable final Sequence contextSequence) {
408410 }
409411
410412 private static class Entry implements Comparable <Entry > {
411- private final List <BitSet > encounteredPrimitiveTypesForOrderSpecs ;
412413 private final List <OrderSpec > orderSpecs ;
413414 private Item item ;
414415 private final int pos ;
@@ -417,13 +418,11 @@ private static class Entry implements Comparable<Entry> {
417418 /**
418419 * Private constructor, use {@link #create(List, List, Item, int, Sequence)} instead.
419420 *
420- * @param encounteredPrimitiveTypesForOrderSpecs a list of bitset which will be populated with the primitive type of each value in the entry of each orderspec
421421 * @param item the item in the sequence.
422422 * @param position the original position of the item in the result sequence.
423423 * @param values the values for the entry.
424424 */
425- private Entry (final List <BitSet > encounteredPrimitiveTypesForOrderSpecs , final List <OrderSpec > orderSpecs , final Item item , final int position , final List <AtomicValue > values ) {
426- this .encounteredPrimitiveTypesForOrderSpecs = encounteredPrimitiveTypesForOrderSpecs ;
425+ private Entry (final List <OrderSpec > orderSpecs , final Item item , final int position , final List <AtomicValue > values ) {
427426 this .orderSpecs = orderSpecs ;
428427 this .item = item ;
429428 this .pos = position ;
@@ -474,7 +473,7 @@ public static Entry create(final List<BitSet> encounteredPrimitiveTypesForOrderS
474473 }
475474 }
476475
477- return new Entry (encounteredPrimitiveTypesForOrderSpecs , orderSpecs , item , position , values );
476+ return new Entry (orderSpecs , item , position , values );
478477 }
479478
480479 @ Override
@@ -555,10 +554,7 @@ public String toString() {
555554 }
556555
557556 public void clear () {
558- for (final BitSet encounteredPrimitiveTypesForOrderSpec : encounteredPrimitiveTypesForOrderSpecs ) {
559- encounteredPrimitiveTypesForOrderSpec .clear ();
560- }
561- values = null ;
557+ this .values = null ;
562558 }
563559 }
564560
0 commit comments