I am trying to write a function that takes an array and returns the array in a different order.
It works with int, double, string, object, or any object in the array.
Follow the function example for String.
public String[] randomize(String[] array, int randomKey)
{
return newStringArray;
}
For all types of objects, I know I can do it like
public Object[] randomize(Object[] array, int randomKey)
{
return newObjectArray;
}
Instead of boxing the entire primitive type into an object, is there any other method, can I just write the algorithm once and without creating a function for each primitive array? Is there a generic array type that works for AND objects?
thank
PS Do not want to use autoboxing due to a penalty for performance. Quote from [autoboxing]: http://docs.oracle.com/javase/1.5.0/docs/guide/language/autoboxing.html
.