Skip to content

Commit

Permalink
Added SortedIterationKTypeVTypeHashMap: a sorted-iteration order view…
Browse files Browse the repository at this point in the history
… over another key-value map.

Co-authored-by: Dawid Weiss <[email protected]>
  • Loading branch information
bruno-roustant and dweiss authored Oct 9, 2021
1 parent dc57e6e commit 415c176
Show file tree
Hide file tree
Showing 13 changed files with 819 additions and 108 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
[0.9.1-SNAPSHOT]

** New features and API changes

GH-28: Added SortedIterationKTypeVTypeHashMap: a sorted-iteration order view over
another key-value map. (Bruno Roustant)

** Improvements

GH-25: Added addAll(KTypeContainer) on KTypeSet. (Erich Schubert, Dawid Weiss).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public void invoke(
arguments.size(), m.group(), arguments));
}

String v1 = arguments.remove(arguments.size() - 1);
String v2 = arguments.remove(arguments.size() - 1);
String v1 = arguments.remove(arguments.size() - 1);

Type type = inferTemplateType(m, templateOptions, genericCast);
switch (type) {
Expand Down
19 changes: 13 additions & 6 deletions hppc/src/main/java/com/carrotsearch/hppc/sorting/IndirectSort.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,21 @@ private IndirectSort() {
*/
public static int[] mergesort(int start, int length, IntBinaryOperator comparator) {
final int[] src = createOrderArray(start, length);
return mergesort(src, comparator);
}

if (length > 1) {
final int[] dst = (int[]) src.clone();
topDownMergeSort(src, dst, 0, length, comparator);
return dst;
/**
* Returns a sorted copy of the order array provided, using the given <code>comparator</code>.
*
* <p>This routine uses merge sort. It is guaranteed to be stable.
*/
public static int[] mergesort(int[] orderArray, IntBinaryOperator comparator) {
if (orderArray.length <= 1) {
return orderArray;
}

return src;
final int[] dst = orderArray.clone();
topDownMergeSort(orderArray, dst, 0, orderArray.length, comparator);
return dst;
}

/**
Expand Down
Loading

0 comments on commit 415c176

Please sign in to comment.