@Override
public int compare(Integer o1, Integer o2)
{
- return ascending ? Float.compare(values[o1], values[o2]) : Float
- .compare(values[o2], values[o1]);
+ return ascending
+ ? Float.compare(values[o1.intValue()], values[o2.intValue()])
+ : Float.compare(values[o2.intValue()], values[o1.intValue()]);
}
}
{
if (ascending)
{
- return Double.compare(values[o1], values[o2]);
+ return Double.compare(values[o1.intValue()], values[o2.intValue()]);
}
else
{
- return Double.compare(values[o2], values[o1]);
+ return Double.compare(values[o2.intValue()], values[o1.intValue()]);
}
}
}
@Override
public int compare(Integer o1, Integer o2)
{
- return ascending ? Integer.compare(values[o1], values[o2]) : Integer
- .compare(values[o2], values[o1]);
+ return ascending
+ ? Integer.compare(values[o1.intValue()],
+ values[o2.intValue()])
+ : Integer.compare(values[o2.intValue()],
+ values[o1.intValue()]);
}
}
@Override
public int compare(Integer o1, Integer o2)
{
- return ascending ? values[o1].compareTo(values[o2]) : values[o2]
- .compareTo(values[o1]);
+ return ascending
+ ? values[o1.intValue()].compareTo(values[o2.intValue()])
+ : values[o2.intValue()].compareTo(values[o1.intValue()]);
}
}
/*
* Copy sorted positive values after the negatives and zeros
*/
- System.arraycopy(nonZeroFloats, negativeCount, arr, negativeCount
- + zerosCount, positiveCount);
- System.arraycopy(nonZeroChars, negativeCount, s, negativeCount
- + zerosCount, positiveCount);
+ System.arraycopy(nonZeroFloats, negativeCount, arr,
+ negativeCount + zerosCount, positiveCount);
+ System.arraycopy(nonZeroChars, negativeCount, s,
+ negativeCount + zerosCount, positiveCount);
}
/**
/*
* Copy sorted positive values after the negatives and zeros
*/
- System.arraycopy(nonZeroInts, negativeCount, arr, negativeCount
- + zerosCount, positiveCount);
- System.arraycopy(nonZeroChars, negativeCount, s, negativeCount
- + zerosCount, positiveCount);
+ System.arraycopy(nonZeroInts, negativeCount, arr,
+ negativeCount + zerosCount, positiveCount);
+ System.arraycopy(nonZeroChars, negativeCount, s,
+ negativeCount + zerosCount, positiveCount);
}
/**
final int length = arr.length;
Integer[] indices = makeIndexArray(length);
Arrays.sort(indices, new IntComparator(arr, ascending));
-
+
/*
* Copy the array values as per the sorted indices
*/
sortedInts[i] = arr[indices[i]];
sortedObjects[i] = s[indices[i]];
}
-
+
/*
* And copy the sorted values back into the arrays
*/
final int length = arr.length;
Integer[] indices = makeIndexArray(length);
Arrays.sort(indices, new ExternalComparator(arr, ascending));
-
+
/*
* Copy the array values as per the sorted indices
*/
sortedStrings[i] = arr[indices[i]];
sortedObjects[i] = s[indices[i]];
}
-
+
/*
* And copy the sorted values back into the arrays
*/
final int length = arr.length;
Integer[] indices = makeIndexArray(length);
Arrays.sort(indices, new DoubleComparator(arr, ascending));
-
+
/*
* Copy the array values as per the sorted indices
*/
sortedDoubles[i] = arr[indices[i]];
sortedObjects[i] = s[indices[i]];
}
-
+
/*
* And copy the sorted values back into the arrays
*/