The situation is I have a function, and it calls Arrays.sort
to sort given array. As Arrays.sort
can sort both String and long, I want to use one single signature instead of two String[] array
and long[] array
.
I've tried something like Comparable[]
, it won't match long[]
. I've also tried change long
to Long
. But the process of boxing and unboxing is significantly slowing down the sorting.
So I am wondering if there is a type I can specify that matches both of them? Or generally match all supported types of Arrays.sort
?